| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/media_stream_video_source.h" | 5 #include "content/renderer/media/media_stream_video_source.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 return static_cast<MediaStreamVideoSource*>(source.GetExtraData()); | 326 return static_cast<MediaStreamVideoSource*>(source.GetExtraData()); |
| 327 } | 327 } |
| 328 | 328 |
| 329 MediaStreamVideoSource::MediaStreamVideoSource() | 329 MediaStreamVideoSource::MediaStreamVideoSource() |
| 330 : state_(NEW), | 330 : state_(NEW), |
| 331 track_adapter_( | 331 track_adapter_( |
| 332 new VideoTrackAdapter(ChildProcess::current()->io_task_runner())), | 332 new VideoTrackAdapter(ChildProcess::current()->io_task_runner())), |
| 333 weak_factory_(this) {} | 333 weak_factory_(this) {} |
| 334 | 334 |
| 335 MediaStreamVideoSource::~MediaStreamVideoSource() { | 335 MediaStreamVideoSource::~MediaStreamVideoSource() { |
| 336 DCHECK(CalledOnValidThread()); | 336 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 337 } | 337 } |
| 338 | 338 |
| 339 void MediaStreamVideoSource::AddTrackLegacy( | 339 void MediaStreamVideoSource::AddTrackLegacy( |
| 340 MediaStreamVideoTrack* track, | 340 MediaStreamVideoTrack* track, |
| 341 const VideoCaptureDeliverFrameCB& frame_callback, | 341 const VideoCaptureDeliverFrameCB& frame_callback, |
| 342 const blink::WebMediaConstraints& constraints, | 342 const blink::WebMediaConstraints& constraints, |
| 343 const ConstraintsCallback& callback) { | 343 const ConstraintsCallback& callback) { |
| 344 DCHECK(CalledOnValidThread()); | 344 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 345 DCHECK(IsOldVideoConstraints()); | 345 DCHECK(IsOldVideoConstraints()); |
| 346 DCHECK(!constraints.IsNull()); | 346 DCHECK(!constraints.IsNull()); |
| 347 DCHECK(std::find(tracks_.begin(), tracks_.end(), track) == tracks_.end()); | 347 DCHECK(std::find(tracks_.begin(), tracks_.end(), track) == tracks_.end()); |
| 348 tracks_.push_back(track); | 348 tracks_.push_back(track); |
| 349 secure_tracker_.Add(track, true); | 349 secure_tracker_.Add(track, true); |
| 350 | 350 |
| 351 track_descriptors_.push_back( | 351 track_descriptors_.push_back( |
| 352 TrackDescriptor(track, frame_callback, constraints, callback)); | 352 TrackDescriptor(track, frame_callback, constraints, callback)); |
| 353 | 353 |
| 354 switch (state_) { | 354 switch (state_) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 FinalizeAddTrackLegacy(); | 390 FinalizeAddTrackLegacy(); |
| 391 } | 391 } |
| 392 } | 392 } |
| 393 } | 393 } |
| 394 | 394 |
| 395 void MediaStreamVideoSource::AddTrack( | 395 void MediaStreamVideoSource::AddTrack( |
| 396 MediaStreamVideoTrack* track, | 396 MediaStreamVideoTrack* track, |
| 397 const VideoTrackAdapterSettings& track_adapter_settings, | 397 const VideoTrackAdapterSettings& track_adapter_settings, |
| 398 const VideoCaptureDeliverFrameCB& frame_callback, | 398 const VideoCaptureDeliverFrameCB& frame_callback, |
| 399 const ConstraintsCallback& callback) { | 399 const ConstraintsCallback& callback) { |
| 400 DCHECK(CalledOnValidThread()); | 400 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 401 DCHECK(std::find(tracks_.begin(), tracks_.end(), track) == tracks_.end()); | 401 DCHECK(std::find(tracks_.begin(), tracks_.end(), track) == tracks_.end()); |
| 402 tracks_.push_back(track); | 402 tracks_.push_back(track); |
| 403 secure_tracker_.Add(track, true); | 403 secure_tracker_.Add(track, true); |
| 404 | 404 |
| 405 track_descriptors_.push_back(TrackDescriptor( | 405 track_descriptors_.push_back(TrackDescriptor( |
| 406 track, frame_callback, | 406 track, frame_callback, |
| 407 base::MakeUnique<VideoTrackAdapterSettings>(track_adapter_settings), | 407 base::MakeUnique<VideoTrackAdapterSettings>(track_adapter_settings), |
| 408 callback)); | 408 callback)); |
| 409 | 409 |
| 410 switch (state_) { | 410 switch (state_) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 425 } | 425 } |
| 426 case ENDED: | 426 case ENDED: |
| 427 case STARTED: { | 427 case STARTED: { |
| 428 // Currently, reconfiguring the source is not supported. | 428 // Currently, reconfiguring the source is not supported. |
| 429 FinalizeAddTrack(); | 429 FinalizeAddTrack(); |
| 430 } | 430 } |
| 431 } | 431 } |
| 432 } | 432 } |
| 433 | 433 |
| 434 void MediaStreamVideoSource::RemoveTrack(MediaStreamVideoTrack* video_track) { | 434 void MediaStreamVideoSource::RemoveTrack(MediaStreamVideoTrack* video_track) { |
| 435 DCHECK(CalledOnValidThread()); | 435 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 436 std::vector<MediaStreamVideoTrack*>::iterator it = | 436 std::vector<MediaStreamVideoTrack*>::iterator it = |
| 437 std::find(tracks_.begin(), tracks_.end(), video_track); | 437 std::find(tracks_.begin(), tracks_.end(), video_track); |
| 438 DCHECK(it != tracks_.end()); | 438 DCHECK(it != tracks_.end()); |
| 439 tracks_.erase(it); | 439 tracks_.erase(it); |
| 440 secure_tracker_.Remove(video_track); | 440 secure_tracker_.Remove(video_track); |
| 441 | 441 |
| 442 for (std::vector<TrackDescriptor>::iterator it = track_descriptors_.begin(); | 442 for (std::vector<TrackDescriptor>::iterator it = track_descriptors_.begin(); |
| 443 it != track_descriptors_.end(); ++it) { | 443 it != track_descriptors_.end(); ++it) { |
| 444 if (it->track == video_track) { | 444 if (it->track == video_track) { |
| 445 track_descriptors_.erase(it); | 445 track_descriptors_.erase(it); |
| 446 break; | 446 break; |
| 447 } | 447 } |
| 448 } | 448 } |
| 449 | 449 |
| 450 // Call |frame_adapter_->RemoveTrack| here even if adding the track has | 450 // Call |frame_adapter_->RemoveTrack| here even if adding the track has |
| 451 // failed and |frame_adapter_->AddCallback| has not been called. | 451 // failed and |frame_adapter_->AddCallback| has not been called. |
| 452 track_adapter_->RemoveTrack(video_track); | 452 track_adapter_->RemoveTrack(video_track); |
| 453 | 453 |
| 454 if (tracks_.empty()) | 454 if (tracks_.empty()) |
| 455 StopSource(); | 455 StopSource(); |
| 456 } | 456 } |
| 457 | 457 |
| 458 void MediaStreamVideoSource::UpdateHasConsumers(MediaStreamVideoTrack* track, | 458 void MediaStreamVideoSource::UpdateHasConsumers(MediaStreamVideoTrack* track, |
| 459 bool has_consumers) { | 459 bool has_consumers) { |
| 460 DCHECK(CalledOnValidThread()); | 460 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 461 const auto it = | 461 const auto it = |
| 462 std::find(suspended_tracks_.begin(), suspended_tracks_.end(), track); | 462 std::find(suspended_tracks_.begin(), suspended_tracks_.end(), track); |
| 463 if (has_consumers) { | 463 if (has_consumers) { |
| 464 if (it != suspended_tracks_.end()) | 464 if (it != suspended_tracks_.end()) |
| 465 suspended_tracks_.erase(it); | 465 suspended_tracks_.erase(it); |
| 466 } else { | 466 } else { |
| 467 if (it == suspended_tracks_.end()) | 467 if (it == suspended_tracks_.end()) |
| 468 suspended_tracks_.push_back(track); | 468 suspended_tracks_.push_back(track); |
| 469 } | 469 } |
| 470 OnHasConsumers(suspended_tracks_.size() < tracks_.size()); | 470 OnHasConsumers(suspended_tracks_.size() < tracks_.size()); |
| 471 } | 471 } |
| 472 | 472 |
| 473 void MediaStreamVideoSource::UpdateCapturingLinkSecure( | 473 void MediaStreamVideoSource::UpdateCapturingLinkSecure( |
| 474 MediaStreamVideoTrack* track, bool is_secure) { | 474 MediaStreamVideoTrack* track, bool is_secure) { |
| 475 DCHECK(CalledOnValidThread()); | 475 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 476 secure_tracker_.Update(track, is_secure); | 476 secure_tracker_.Update(track, is_secure); |
| 477 OnCapturingLinkSecured(secure_tracker_.is_capturing_secure()); | 477 OnCapturingLinkSecured(secure_tracker_.is_capturing_secure()); |
| 478 } | 478 } |
| 479 | 479 |
| 480 base::SingleThreadTaskRunner* MediaStreamVideoSource::io_task_runner() const { | 480 base::SingleThreadTaskRunner* MediaStreamVideoSource::io_task_runner() const { |
| 481 DCHECK(CalledOnValidThread()); | 481 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 482 return track_adapter_->io_task_runner(); | 482 return track_adapter_->io_task_runner(); |
| 483 } | 483 } |
| 484 | 484 |
| 485 base::Optional<media::VideoCaptureFormat> | 485 base::Optional<media::VideoCaptureFormat> |
| 486 MediaStreamVideoSource::GetCurrentFormat() const { | 486 MediaStreamVideoSource::GetCurrentFormat() const { |
| 487 DCHECK(CalledOnValidThread()); | 487 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 488 if (IsOldVideoConstraints()) { | 488 if (IsOldVideoConstraints()) { |
| 489 if (state_ == STARTING || state_ == STARTED) | 489 if (state_ == STARTING || state_ == STARTED) |
| 490 return current_format_; | 490 return current_format_; |
| 491 return base::Optional<media::VideoCaptureFormat>(); | 491 return base::Optional<media::VideoCaptureFormat>(); |
| 492 } else { | 492 } else { |
| 493 return GetCurrentFormatImpl(); | 493 return GetCurrentFormatImpl(); |
| 494 } | 494 } |
| 495 } | 495 } |
| 496 | 496 |
| 497 base::Optional<media::VideoCaptureFormat> | 497 base::Optional<media::VideoCaptureFormat> |
| 498 MediaStreamVideoSource::GetCurrentFormatImpl() const { | 498 MediaStreamVideoSource::GetCurrentFormatImpl() const { |
| 499 return base::Optional<media::VideoCaptureFormat>(); | 499 return base::Optional<media::VideoCaptureFormat>(); |
| 500 } | 500 } |
| 501 | 501 |
| 502 void MediaStreamVideoSource::DoStopSource() { | 502 void MediaStreamVideoSource::DoStopSource() { |
| 503 DCHECK(CalledOnValidThread()); | 503 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 504 DVLOG(3) << "DoStopSource()"; | 504 DVLOG(3) << "DoStopSource()"; |
| 505 if (state_ == ENDED) | 505 if (state_ == ENDED) |
| 506 return; | 506 return; |
| 507 track_adapter_->StopFrameMonitoring(); | 507 track_adapter_->StopFrameMonitoring(); |
| 508 StopSourceImpl(); | 508 StopSourceImpl(); |
| 509 state_ = ENDED; | 509 state_ = ENDED; |
| 510 SetReadyState(blink::WebMediaStreamSource::kReadyStateEnded); | 510 SetReadyState(blink::WebMediaStreamSource::kReadyStateEnded); |
| 511 } | 511 } |
| 512 | 512 |
| 513 void MediaStreamVideoSource::OnSupportedFormats( | 513 void MediaStreamVideoSource::OnSupportedFormats( |
| 514 const media::VideoCaptureFormats& formats) { | 514 const media::VideoCaptureFormats& formats) { |
| 515 DCHECK(CalledOnValidThread()); | 515 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 516 DCHECK(IsOldVideoConstraints()); | 516 DCHECK(IsOldVideoConstraints()); |
| 517 DCHECK_EQ(RETRIEVING_CAPABILITIES, state_); | 517 DCHECK_EQ(RETRIEVING_CAPABILITIES, state_); |
| 518 | 518 |
| 519 supported_formats_ = formats; | 519 supported_formats_ = formats; |
| 520 blink::WebMediaConstraints fulfilled_constraints; | 520 blink::WebMediaConstraints fulfilled_constraints; |
| 521 if (!FindBestFormatWithConstraints(supported_formats_, | 521 if (!FindBestFormatWithConstraints(supported_formats_, |
| 522 ¤t_format_, | 522 ¤t_format_, |
| 523 &fulfilled_constraints)) { | 523 &fulfilled_constraints)) { |
| 524 SetReadyState(blink::WebMediaStreamSource::kReadyStateEnded); | 524 SetReadyState(blink::WebMediaStreamSource::kReadyStateEnded); |
| 525 DVLOG(3) << "OnSupportedFormats failed to find an usable format"; | 525 DVLOG(3) << "OnSupportedFormats failed to find an usable format"; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 536 StartSourceImpl( | 536 StartSourceImpl( |
| 537 current_format_, | 537 current_format_, |
| 538 fulfilled_constraints, | 538 fulfilled_constraints, |
| 539 base::Bind(&VideoTrackAdapter::DeliverFrameOnIO, track_adapter_)); | 539 base::Bind(&VideoTrackAdapter::DeliverFrameOnIO, track_adapter_)); |
| 540 } | 540 } |
| 541 | 541 |
| 542 bool MediaStreamVideoSource::FindBestFormatWithConstraints( | 542 bool MediaStreamVideoSource::FindBestFormatWithConstraints( |
| 543 const media::VideoCaptureFormats& formats, | 543 const media::VideoCaptureFormats& formats, |
| 544 media::VideoCaptureFormat* best_format, | 544 media::VideoCaptureFormat* best_format, |
| 545 blink::WebMediaConstraints* fulfilled_constraints) { | 545 blink::WebMediaConstraints* fulfilled_constraints) { |
| 546 DCHECK(CalledOnValidThread()); | 546 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 547 DVLOG(3) << "MediaStreamVideoSource::FindBestFormatWithConstraints " | 547 DVLOG(3) << "MediaStreamVideoSource::FindBestFormatWithConstraints " |
| 548 << "with " << formats.size() << " formats"; | 548 << "with " << formats.size() << " formats"; |
| 549 // Find the first track descriptor that can fulfil the constraints. | 549 // Find the first track descriptor that can fulfil the constraints. |
| 550 for (const auto& track : track_descriptors_) { | 550 for (const auto& track : track_descriptors_) { |
| 551 const blink::WebMediaConstraints& track_constraints = track.constraints; | 551 const blink::WebMediaConstraints& track_constraints = track.constraints; |
| 552 | 552 |
| 553 // If the source doesn't support capability enumeration it is still ok if | 553 // If the source doesn't support capability enumeration it is still ok if |
| 554 // no mandatory constraints have been specified. That just means that | 554 // no mandatory constraints have been specified. That just means that |
| 555 // we will start with whatever format is native to the source. | 555 // we will start with whatever format is native to the source. |
| 556 if (formats.empty() && !HasMandatoryConstraints(track_constraints)) { | 556 if (formats.empty() && !HasMandatoryConstraints(track_constraints)) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 574 | 574 |
| 575 *best_format = best_format_candidate; | 575 *best_format = best_format_candidate; |
| 576 DVLOG(3) << "Found a track that matches the constraints"; | 576 DVLOG(3) << "Found a track that matches the constraints"; |
| 577 return true; | 577 return true; |
| 578 } | 578 } |
| 579 DVLOG(3) << "No usable format found"; | 579 DVLOG(3) << "No usable format found"; |
| 580 return false; | 580 return false; |
| 581 } | 581 } |
| 582 | 582 |
| 583 void MediaStreamVideoSource::OnStartDone(MediaStreamRequestResult result) { | 583 void MediaStreamVideoSource::OnStartDone(MediaStreamRequestResult result) { |
| 584 DCHECK(CalledOnValidThread()); | 584 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 585 DVLOG(3) << "OnStartDone({result =" << result << "})"; | 585 DVLOG(3) << "OnStartDone({result =" << result << "})"; |
| 586 if (result == MEDIA_DEVICE_OK) { | 586 if (result == MEDIA_DEVICE_OK) { |
| 587 DCHECK_EQ(STARTING, state_); | 587 DCHECK_EQ(STARTING, state_); |
| 588 state_ = STARTED; | 588 state_ = STARTED; |
| 589 SetReadyState(blink::WebMediaStreamSource::kReadyStateLive); | 589 SetReadyState(blink::WebMediaStreamSource::kReadyStateLive); |
| 590 double frame_rate = | 590 double frame_rate = |
| 591 GetCurrentFormat() ? GetCurrentFormat()->frame_rate : 0.0; | 591 GetCurrentFormat() ? GetCurrentFormat()->frame_rate : 0.0; |
| 592 track_adapter_->StartFrameMonitoring( | 592 track_adapter_->StartFrameMonitoring( |
| 593 frame_rate, base::Bind(&MediaStreamVideoSource::SetMutedState, | 593 frame_rate, base::Bind(&MediaStreamVideoSource::SetMutedState, |
| 594 weak_factory_.GetWeakPtr())); | 594 weak_factory_.GetWeakPtr())); |
| 595 } else { | 595 } else { |
| 596 StopSource(); | 596 StopSource(); |
| 597 } | 597 } |
| 598 | 598 |
| 599 // This object can be deleted after calling FinalizeAddTrack. See comment in | 599 // This object can be deleted after calling FinalizeAddTrack. See comment in |
| 600 // the header file. | 600 // the header file. |
| 601 if (IsOldVideoConstraints()) | 601 if (IsOldVideoConstraints()) |
| 602 FinalizeAddTrackLegacy(); | 602 FinalizeAddTrackLegacy(); |
| 603 else | 603 else |
| 604 FinalizeAddTrack(); | 604 FinalizeAddTrack(); |
| 605 } | 605 } |
| 606 | 606 |
| 607 void MediaStreamVideoSource::FinalizeAddTrackLegacy() { | 607 void MediaStreamVideoSource::FinalizeAddTrackLegacy() { |
| 608 DCHECK(CalledOnValidThread()); | 608 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 609 DCHECK(IsOldVideoConstraints()); | 609 DCHECK(IsOldVideoConstraints()); |
| 610 const media::VideoCaptureFormats formats(1, current_format_); | 610 const media::VideoCaptureFormats formats(1, current_format_); |
| 611 | 611 |
| 612 std::vector<TrackDescriptor> track_descriptors; | 612 std::vector<TrackDescriptor> track_descriptors; |
| 613 track_descriptors.swap(track_descriptors_); | 613 track_descriptors.swap(track_descriptors_); |
| 614 for (const auto& track : track_descriptors) { | 614 for (const auto& track : track_descriptors) { |
| 615 MediaStreamRequestResult result = MEDIA_DEVICE_OK; | 615 MediaStreamRequestResult result = MEDIA_DEVICE_OK; |
| 616 std::string unsatisfied_constraint; | 616 std::string unsatisfied_constraint; |
| 617 | 617 |
| 618 if (HasMandatoryConstraints(track.constraints) && | 618 if (HasMandatoryConstraints(track.constraints) && |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 | 659 |
| 660 DVLOG(3) << "FinalizeAddTrackLegacy() result " << result; | 660 DVLOG(3) << "FinalizeAddTrackLegacy() result " << result; |
| 661 | 661 |
| 662 if (!track.callback.is_null()) | 662 if (!track.callback.is_null()) |
| 663 track.callback.Run(this, result, | 663 track.callback.Run(this, result, |
| 664 blink::WebString::FromUTF8(unsatisfied_constraint)); | 664 blink::WebString::FromUTF8(unsatisfied_constraint)); |
| 665 } | 665 } |
| 666 } | 666 } |
| 667 | 667 |
| 668 void MediaStreamVideoSource::FinalizeAddTrack() { | 668 void MediaStreamVideoSource::FinalizeAddTrack() { |
| 669 DCHECK(CalledOnValidThread()); | 669 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 670 DCHECK(!IsOldVideoConstraints()); | 670 DCHECK(!IsOldVideoConstraints()); |
| 671 std::vector<TrackDescriptor> track_descriptors; | 671 std::vector<TrackDescriptor> track_descriptors; |
| 672 track_descriptors.swap(track_descriptors_); | 672 track_descriptors.swap(track_descriptors_); |
| 673 for (const auto& track : track_descriptors) { | 673 for (const auto& track : track_descriptors) { |
| 674 MediaStreamRequestResult result = MEDIA_DEVICE_OK; | 674 MediaStreamRequestResult result = MEDIA_DEVICE_OK; |
| 675 if (state_ != STARTED) | 675 if (state_ != STARTED) |
| 676 result = MEDIA_DEVICE_TRACK_START_FAILURE; | 676 result = MEDIA_DEVICE_TRACK_START_FAILURE; |
| 677 | 677 |
| 678 if (result == MEDIA_DEVICE_OK) { | 678 if (result == MEDIA_DEVICE_OK) { |
| 679 track_adapter_->AddTrack(track.track, track.frame_callback, | 679 track_adapter_->AddTrack(track.track, track.frame_callback, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 697 } | 697 } |
| 698 | 698 |
| 699 if (!track.callback.is_null()) | 699 if (!track.callback.is_null()) |
| 700 track.callback.Run(this, result, blink::WebString()); | 700 track.callback.Run(this, result, blink::WebString()); |
| 701 } | 701 } |
| 702 } | 702 } |
| 703 | 703 |
| 704 void MediaStreamVideoSource::SetReadyState( | 704 void MediaStreamVideoSource::SetReadyState( |
| 705 blink::WebMediaStreamSource::ReadyState state) { | 705 blink::WebMediaStreamSource::ReadyState state) { |
| 706 DVLOG(3) << "MediaStreamVideoSource::SetReadyState state " << state; | 706 DVLOG(3) << "MediaStreamVideoSource::SetReadyState state " << state; |
| 707 DCHECK(CalledOnValidThread()); | 707 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 708 if (!Owner().IsNull()) | 708 if (!Owner().IsNull()) |
| 709 Owner().SetReadyState(state); | 709 Owner().SetReadyState(state); |
| 710 for (auto* track : tracks_) | 710 for (auto* track : tracks_) |
| 711 track->OnReadyStateChanged(state); | 711 track->OnReadyStateChanged(state); |
| 712 } | 712 } |
| 713 | 713 |
| 714 void MediaStreamVideoSource::SetMutedState(bool muted_state) { | 714 void MediaStreamVideoSource::SetMutedState(bool muted_state) { |
| 715 DVLOG(3) << "MediaStreamVideoSource::SetMutedState state=" << muted_state; | 715 DVLOG(3) << "MediaStreamVideoSource::SetMutedState state=" << muted_state; |
| 716 DCHECK(CalledOnValidThread()); | 716 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 717 if (!Owner().IsNull()) { | 717 if (!Owner().IsNull()) { |
| 718 Owner().SetReadyState(muted_state | 718 Owner().SetReadyState(muted_state |
| 719 ? blink::WebMediaStreamSource::kReadyStateMuted | 719 ? blink::WebMediaStreamSource::kReadyStateMuted |
| 720 : blink::WebMediaStreamSource::kReadyStateLive); | 720 : blink::WebMediaStreamSource::kReadyStateLive); |
| 721 } | 721 } |
| 722 } | 722 } |
| 723 | 723 |
| 724 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( | 724 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( |
| 725 MediaStreamVideoTrack* track, | 725 MediaStreamVideoTrack* track, |
| 726 const VideoCaptureDeliverFrameCB& frame_callback, | 726 const VideoCaptureDeliverFrameCB& frame_callback, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 748 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( | 748 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( |
| 749 TrackDescriptor&& other) = default; | 749 TrackDescriptor&& other) = default; |
| 750 MediaStreamVideoSource::TrackDescriptor& | 750 MediaStreamVideoSource::TrackDescriptor& |
| 751 MediaStreamVideoSource::TrackDescriptor::operator=( | 751 MediaStreamVideoSource::TrackDescriptor::operator=( |
| 752 MediaStreamVideoSource::TrackDescriptor&& other) = default; | 752 MediaStreamVideoSource::TrackDescriptor&& other) = default; |
| 753 | 753 |
| 754 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() { | 754 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() { |
| 755 } | 755 } |
| 756 | 756 |
| 757 } // namespace content | 757 } // namespace content |
| OLD | NEW |