 Chromium Code Reviews
 Chromium Code Reviews Issue 1861633002:
  Extended proxy abstraction, to call certain methods to the worker thread.  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc.git@master
    
  
    Issue 1861633002:
  Extended proxy abstraction, to call certain methods to the worker thread.  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc.git@master| OLD | NEW | 
|---|---|
| 1 /* | 1 /* | 
| 2 * Copyright 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2011 The WebRTC project authors. All Rights Reserved. | 
| 3 * | 3 * | 
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license | 
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source | 
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found | 
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may | 
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. | 
| 9 */ | 9 */ | 
| 10 | 10 | 
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 } | 24 } | 
| 25 | 25 | 
| 26 VideoTrack::~VideoTrack() { | 26 VideoTrack::~VideoTrack() { | 
| 27 video_source_->UnregisterObserver(this); | 27 video_source_->UnregisterObserver(this); | 
| 28 } | 28 } | 
| 29 | 29 | 
| 30 std::string VideoTrack::kind() const { | 30 std::string VideoTrack::kind() const { | 
| 31 return kVideoKind; | 31 return kVideoKind; | 
| 32 } | 32 } | 
| 33 | 33 | 
| 34 // AddOrUpdateSink and RemoveSink should be called on the worker | |
| 35 // thread. | |
| 34 void VideoTrack::AddOrUpdateSink( | 36 void VideoTrack::AddOrUpdateSink( | 
| 35 rtc::VideoSinkInterface<cricket::VideoFrame>* sink, | 37 rtc::VideoSinkInterface<cricket::VideoFrame>* sink, | 
| 36 const rtc::VideoSinkWants& wants) { | 38 const rtc::VideoSinkWants& wants) { | 
| 37 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 39 // RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 
| 
nisse-webrtc
2016/04/05 10:13:46
Should we have another rtc::ThreadChecker, bound t
 
perkj_webrtc
2016/04/05 11:02:37
yes please.
 
nisse-webrtc
2016/04/05 11:43:55
Done.
 | |
| 38 VideoSourceBase::AddOrUpdateSink(sink, wants); | 40 VideoSourceBase::AddOrUpdateSink(sink, wants); | 
| 39 rtc::VideoSinkWants modified_wants = wants; | 41 rtc::VideoSinkWants modified_wants = wants; | 
| 40 modified_wants.black_frames = !enabled(); | 42 modified_wants.black_frames = !enabled(); | 
| 41 video_source_->AddOrUpdateSink(sink, modified_wants); | 43 video_source_->AddOrUpdateSink(sink, modified_wants); | 
| 42 } | 44 } | 
| 43 | 45 | 
| 44 void VideoTrack::RemoveSink( | 46 void VideoTrack::RemoveSink( | 
| 45 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { | 47 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { | 
| 46 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 48 // RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 
| 47 VideoSourceBase::RemoveSink(sink); | 49 VideoSourceBase::RemoveSink(sink); | 
| 48 video_source_->RemoveSink(sink); | 50 video_source_->RemoveSink(sink); | 
| 49 } | 51 } | 
| 50 | 52 | 
| 51 bool VideoTrack::set_enabled(bool enable) { | 53 bool VideoTrack::set_enabled(bool enable) { | 
| 52 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 54 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 
| 53 for (auto& sink_pair : sink_pairs()) { | 55 for (auto& sink_pair : sink_pairs()) { | 
| 54 rtc::VideoSinkWants modified_wants = sink_pair.wants; | 56 rtc::VideoSinkWants modified_wants = sink_pair.wants; | 
| 55 modified_wants.black_frames = !enable; | 57 modified_wants.black_frames = !enable; | 
| 58 // video_source_ is a proxy object, marshalling the call to the | |
| 59 // worker thread. | |
| 
perkj_webrtc
2016/04/05 11:02:37
Can you verify if this is true for remote video so
 
nisse-webrtc
2016/04/05 11:43:55
I'm looking at the VideoRtpReceiver constructor. I
 | |
| 56 video_source_->AddOrUpdateSink(sink_pair.sink, modified_wants); | 60 video_source_->AddOrUpdateSink(sink_pair.sink, modified_wants); | 
| 57 } | 61 } | 
| 58 return MediaStreamTrack<VideoTrackInterface>::set_enabled(enable); | 62 return MediaStreamTrack<VideoTrackInterface>::set_enabled(enable); | 
| 59 } | 63 } | 
| 60 | 64 | 
| 61 void VideoTrack::OnChanged() { | 65 void VideoTrack::OnChanged() { | 
| 62 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 66 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 
| 63 if (video_source_->state() == MediaSourceInterface::kEnded) { | 67 if (video_source_->state() == MediaSourceInterface::kEnded) { | 
| 64 set_state(kEnded); | 68 set_state(kEnded); | 
| 65 } else { | 69 } else { | 
| 66 set_state(kLive); | 70 set_state(kLive); | 
| 67 } | 71 } | 
| 68 } | 72 } | 
| 69 | 73 | 
| 70 rtc::scoped_refptr<VideoTrack> VideoTrack::Create( | 74 rtc::scoped_refptr<VideoTrack> VideoTrack::Create( | 
| 71 const std::string& id, | 75 const std::string& id, | 
| 72 VideoTrackSourceInterface* source) { | 76 VideoTrackSourceInterface* source) { | 
| 73 rtc::RefCountedObject<VideoTrack>* track = | 77 rtc::RefCountedObject<VideoTrack>* track = | 
| 74 new rtc::RefCountedObject<VideoTrack>(id, source); | 78 new rtc::RefCountedObject<VideoTrack>(id, source); | 
| 75 return track; | 79 return track; | 
| 76 } | 80 } | 
| 77 | 81 | 
| 78 } // namespace webrtc | 82 } // namespace webrtc | 
| OLD | NEW |