blob: cf0ffd71d0bef61aac8dfc7394c91999582f36de [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
Mirko Bonadei92ea95e2017-09-15 04:47:3111#include "pc/videotracksource.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
17VideoTrackSource::VideoTrackSource(
perkj0d3eef22016-03-09 01:39:1718 bool remote)
Niels Möllerc17ca532018-05-31 13:36:4919 : state_(kInitializing), remote_(remote) {
nisse5b68ab52016-04-07 14:45:5420 worker_thread_checker_.DetachFromThread();
21}
perkj0d3eef22016-03-09 01:39:1722
23void VideoTrackSource::SetState(SourceState new_state) {
24 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) {
nisse5b68ab52016-04-07 14:45:5433 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
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) {
nisse5b68ab52016-04-07 14:45:5438 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
Niels Möller5d67f822018-05-23 14:28:1739 source()->RemoveSink(sink);
perkj0d3eef22016-03-09 01:39:1740}
41
42} // namespace webrtc