Thanks to visit codestin.com
Credit goes to webrtc.googlesource.com

blob: d9b5f1937cb7d3de47bc03eda86dd3ec77bba2ea [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
Harald Alvestrandf0d5caf2025-04-07 09:08:5113#include "api/media_stream_interface.h"
14#include "api/sequence_checker.h"
15#include "api/video/video_frame.h"
16#include "api/video/video_sink_interface.h"
17#include "api/video/video_source_interface.h"
Yves Gerey3e707812018-11-28 15:47:4918#include "rtc_base/checks.h"
perkj0d3eef22016-03-09 01:39:1719
perkj0d3eef22016-03-09 01:39:1720namespace webrtc {
21
Jonas Olssona4d87372019-07-05 17:08:3322VideoTrackSource::VideoTrackSource(bool remote)
Tommic8482682023-03-23 21:20:3923 : state_(kInitializing), remote_(remote) {}
perkj0d3eef22016-03-09 01:39:1724
25void VideoTrackSource::SetState(SourceState new_state) {
Tommi20d8d912022-02-08 20:12:1526 RTC_DCHECK_RUN_ON(&signaling_thread_checker_);
perkj0d3eef22016-03-09 01:39:1727 if (state_ != new_state) {
28 state_ = new_state;
29 FireOnChanged();
30 }
31}
32
Evan Shrubsolee6a1f702025-04-15 14:55:4233void VideoTrackSource::AddOrUpdateSink(VideoSinkInterface<VideoFrame>* sink,
34 const VideoSinkWants& wants) {
Sebastian Janssonc01367d2019-04-08 13:20:4435 RTC_DCHECK(worker_thread_checker_.IsCurrent());
Niels Möller5d67f822018-05-23 14:28:1736 source()->AddOrUpdateSink(sink, wants);
perkj0d3eef22016-03-09 01:39:1737}
38
Evan Shrubsolee6a1f702025-04-15 14:55:4239void VideoTrackSource::RemoveSink(VideoSinkInterface<VideoFrame>* sink) {
Sebastian Janssonc01367d2019-04-08 13:20:4440 RTC_DCHECK(worker_thread_checker_.IsCurrent());
Niels Möller5d67f822018-05-23 14:28:1741 source()->RemoveSink(sink);
perkj0d3eef22016-03-09 01:39:1742}
43
44} // namespace webrtc