1 /* 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. 3 * 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 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #include "pc/video_track_source.h" 12 13 #include "rtc_base/checks.h" 14 15 namespace webrtc { 16 VideoTrackSource(bool remote)17VideoTrackSource::VideoTrackSource(bool remote) 18 : state_(kInitializing), remote_(remote) { 19 worker_thread_checker_.Detach(); 20 } 21 SetState(SourceState new_state)22void VideoTrackSource::SetState(SourceState new_state) { 23 if (state_ != new_state) { 24 state_ = new_state; 25 FireOnChanged(); 26 } 27 } 28 AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame> * sink,const rtc::VideoSinkWants & wants)29void VideoTrackSource::AddOrUpdateSink( 30 rtc::VideoSinkInterface<VideoFrame>* sink, 31 const rtc::VideoSinkWants& wants) { 32 RTC_DCHECK(worker_thread_checker_.IsCurrent()); 33 source()->AddOrUpdateSink(sink, wants); 34 } 35 RemoveSink(rtc::VideoSinkInterface<VideoFrame> * sink)36void VideoTrackSource::RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) { 37 RTC_DCHECK(worker_thread_checker_.IsCurrent()); 38 source()->RemoveSink(sink); 39 } 40 41 } // namespace webrtc 42