| 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 16 matching lines...) Expand all Loading... |
| 27 VideoTrack::~VideoTrack() { | 27 VideoTrack::~VideoTrack() { |
| 28 video_source_->UnregisterObserver(this); | 28 video_source_->UnregisterObserver(this); |
| 29 } | 29 } |
| 30 | 30 |
| 31 std::string VideoTrack::kind() const { | 31 std::string VideoTrack::kind() const { |
| 32 return kVideoKind; | 32 return kVideoKind; |
| 33 } | 33 } |
| 34 | 34 |
| 35 // AddOrUpdateSink and RemoveSink should be called on the worker | 35 // AddOrUpdateSink and RemoveSink should be called on the worker |
| 36 // thread. | 36 // thread. |
| 37 void VideoTrack::AddOrUpdateSink( | 37 void VideoTrack::AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, |
| 38 rtc::VideoSinkInterface<cricket::VideoFrame>* sink, | 38 const rtc::VideoSinkWants& wants) { |
| 39 const rtc::VideoSinkWants& wants) { | |
| 40 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 39 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 41 VideoSourceBase::AddOrUpdateSink(sink, wants); | 40 VideoSourceBase::AddOrUpdateSink(sink, wants); |
| 42 rtc::VideoSinkWants modified_wants = wants; | 41 rtc::VideoSinkWants modified_wants = wants; |
| 43 modified_wants.black_frames = !enabled(); | 42 modified_wants.black_frames = !enabled(); |
| 44 video_source_->AddOrUpdateSink(sink, modified_wants); | 43 video_source_->AddOrUpdateSink(sink, modified_wants); |
| 45 } | 44 } |
| 46 | 45 |
| 47 void VideoTrack::RemoveSink( | 46 void VideoTrack::RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) { |
| 48 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { | |
| 49 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 47 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 50 VideoSourceBase::RemoveSink(sink); | 48 VideoSourceBase::RemoveSink(sink); |
| 51 video_source_->RemoveSink(sink); | 49 video_source_->RemoveSink(sink); |
| 52 } | 50 } |
| 53 | 51 |
| 54 bool VideoTrack::set_enabled(bool enable) { | 52 bool VideoTrack::set_enabled(bool enable) { |
| 55 RTC_DCHECK(signaling_thread_checker_.CalledOnValidThread()); | 53 RTC_DCHECK(signaling_thread_checker_.CalledOnValidThread()); |
| 56 for (auto& sink_pair : sink_pairs()) { | 54 for (auto& sink_pair : sink_pairs()) { |
| 57 rtc::VideoSinkWants modified_wants = sink_pair.wants; | 55 rtc::VideoSinkWants modified_wants = sink_pair.wants; |
| 58 modified_wants.black_frames = !enable; | 56 modified_wants.black_frames = !enable; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 74 | 72 |
| 75 rtc::scoped_refptr<VideoTrack> VideoTrack::Create( | 73 rtc::scoped_refptr<VideoTrack> VideoTrack::Create( |
| 76 const std::string& id, | 74 const std::string& id, |
| 77 VideoTrackSourceInterface* source) { | 75 VideoTrackSourceInterface* source) { |
| 78 rtc::RefCountedObject<VideoTrack>* track = | 76 rtc::RefCountedObject<VideoTrack>* track = |
| 79 new rtc::RefCountedObject<VideoTrack>(id, source); | 77 new rtc::RefCountedObject<VideoTrack>(id, source); |
| 80 return track; | 78 return track; |
| 81 } | 79 } |
| 82 | 80 |
| 83 } // namespace webrtc | 81 } // namespace webrtc |
| OLD | NEW |