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