blob: 64e99cc064c3f2ddd99b0aea24d43d1895964780 [file] [log] [blame]
perkj11e18052016-03-07 21:03:231/*
perkj11e18052016-03-07 21:03:232 * 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
Steve Anton10542f22019-01-11 17:11:0011#include "pc/video_track_source.h"
perkj11e18052016-03-07 21:03:2312
Yves Gerey3e707812018-11-28 15:47:4913#include "rtc_base/checks.h"
perkj0d3eef22016-03-09 01:39:1714
perkj0d3eef22016-03-09 01:39:1715namespace webrtc {
16
Jonas Olssona4d87372019-07-05 17:08:3317VideoTrackSource::VideoTrackSource(bool remote)
Tommi20d8d912022-02-08 20:12:1518 : state_(kInitializing), remote_(remote) {
Sebastian Janssonc01367d2019-04-08 13:20:4419 worker_thread_checker_.Detach();
nisse5b68ab52016-04-07 14:45:5420}
perkj0d3eef22016-03-09 01:39:1721
22void VideoTrackSource::SetState(SourceState new_state) {
Tommi20d8d912022-02-08 20:12:1523 RTC_DCHECK_RUN_ON(&signaling_thread_checker_);
perkj0d3eef22016-03-09 01:39:1724 if (state_ != new_state) {
25 state_ = new_state;
26 FireOnChanged();
27 }
28}
29
30void VideoTrackSource::AddOrUpdateSink(
nisseacd935b2016-11-11 11:55:1331 rtc::VideoSinkInterface<VideoFrame>* sink,
perkj0d3eef22016-03-09 01:39:1732 const rtc::VideoSinkWants& wants) {
Sebastian Janssonc01367d2019-04-08 13:20:4433 RTC_DCHECK(worker_thread_checker_.IsCurrent());
Niels Möller5d67f822018-05-23 14:28:1734 source()->AddOrUpdateSink(sink, wants);
perkj0d3eef22016-03-09 01:39:1735}
36
nisseacd935b2016-11-11 11:55:1337void VideoTrackSource::RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) {
Sebastian Janssonc01367d2019-04-08 13:20:4438 RTC_DCHECK(worker_thread_checker_.IsCurrent());
Niels Möller5d67f822018-05-23 14:28:1739 source()->RemoveSink(sink);
perkj0d3eef22016-03-09 01:39:1740}
41
42} // namespace webrtc