| Index: webrtc/pc/videotrack.cc
|
| diff --git a/webrtc/pc/videotrack.cc b/webrtc/pc/videotrack.cc
|
| index f106460164731f4b32facb3201403a4c3e6bf66c..494d728b1eaad2ba204308cbb84f708af2706304 100644
|
| --- a/webrtc/pc/videotrack.cc
|
| +++ b/webrtc/pc/videotrack.cc
|
| @@ -15,12 +15,11 @@
|
| namespace webrtc {
|
|
|
| VideoTrack::VideoTrack(const std::string& label,
|
| - VideoTrackSourceInterface* video_source,
|
| - rtc::Thread* worker_thread)
|
| + VideoTrackSourceInterface* video_source)
|
| : MediaStreamTrack<VideoTrackInterface>(label),
|
| - worker_thread_(worker_thread),
|
| video_source_(video_source),
|
| content_hint_(ContentHint::kNone) {
|
| + worker_thread_checker_.DetachFromThread();
|
| video_source_->RegisterObserver(this);
|
| }
|
|
|
| @@ -36,7 +35,7 @@
|
| // thread.
|
| void VideoTrack::AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
|
| const rtc::VideoSinkWants& wants) {
|
| - RTC_DCHECK(worker_thread_->IsCurrent());
|
| + RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
|
| VideoSourceBase::AddOrUpdateSink(sink, wants);
|
| rtc::VideoSinkWants modified_wants = wants;
|
| modified_wants.black_frames = !enabled();
|
| @@ -44,7 +43,7 @@
|
| }
|
|
|
| void VideoTrack::RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) {
|
| - RTC_DCHECK(worker_thread_->IsCurrent());
|
| + RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
|
| VideoSourceBase::RemoveSink(sink);
|
| video_source_->RemoveSink(sink);
|
| }
|
| @@ -64,14 +63,13 @@
|
|
|
| bool VideoTrack::set_enabled(bool enable) {
|
| RTC_DCHECK(signaling_thread_checker_.CalledOnValidThread());
|
| - worker_thread_->Invoke<void>(RTC_FROM_HERE, [enable, this] {
|
| - RTC_DCHECK(worker_thread_->IsCurrent());
|
| - for (auto& sink_pair : sink_pairs()) {
|
| - rtc::VideoSinkWants modified_wants = sink_pair.wants;
|
| - modified_wants.black_frames = !enable;
|
| - video_source_->AddOrUpdateSink(sink_pair.sink, modified_wants);
|
| - }
|
| - });
|
| + for (auto& sink_pair : sink_pairs()) {
|
| + rtc::VideoSinkWants modified_wants = sink_pair.wants;
|
| + modified_wants.black_frames = !enable;
|
| + // video_source_ is a proxy object, marshalling the call to the
|
| + // worker thread.
|
| + video_source_->AddOrUpdateSink(sink_pair.sink, modified_wants);
|
| + }
|
| return MediaStreamTrack<VideoTrackInterface>::set_enabled(enable);
|
| }
|
|
|
| @@ -86,10 +84,9 @@
|
|
|
| rtc::scoped_refptr<VideoTrack> VideoTrack::Create(
|
| const std::string& id,
|
| - VideoTrackSourceInterface* source,
|
| - rtc::Thread* worker_thread) {
|
| + VideoTrackSourceInterface* source) {
|
| rtc::RefCountedObject<VideoTrack>* track =
|
| - new rtc::RefCountedObject<VideoTrack>(id, source, worker_thread);
|
| + new rtc::RefCountedObject<VideoTrack>(id, source);
|
| return track;
|
| }
|
|
|
|
|