You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. #include "pc/video_track_source.h"
  11. #include "rtc_base/checks.h"
  12. namespace webrtc {
  13. VideoTrackSource::VideoTrackSource(bool remote)
  14. : state_(kInitializing), remote_(remote) {
  15. worker_thread_checker_.Detach();
  16. }
  17. void VideoTrackSource::SetState(SourceState new_state) {
  18. if (state_ != new_state) {
  19. state_ = new_state;
  20. FireOnChanged();
  21. }
  22. }
  23. void VideoTrackSource::AddOrUpdateSink(
  24. rtc::VideoSinkInterface<VideoFrame>* sink,
  25. const rtc::VideoSinkWants& wants) {
  26. RTC_DCHECK(worker_thread_checker_.IsCurrent());
  27. source()->AddOrUpdateSink(sink, wants);
  28. }
  29. void VideoTrackSource::RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) {
  30. RTC_DCHECK(worker_thread_checker_.IsCurrent());
  31. source()->RemoveSink(sink);
  32. }
  33. } // namespace webrtc