blob: 3f568f642bd8b349c2d60e5570b78967afa3a93f [file] [log] [blame]
ossu7bb87ee2017-01-23 12:56:251/*
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
Steve Anton10542f22019-01-11 17:11:0011#ifndef PC_VIDEO_TRACK_SOURCE_H_
12#define PC_VIDEO_TRACK_SOURCE_H_
ossu7bb87ee2017-01-23 12:56:2513
Harald Alvestrand5761e7b2021-01-29 14:45:0814#include "absl/types/optional.h"
Steve Anton10542f22019-01-11 17:11:0015#include "api/media_stream_interface.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3116#include "api/notifier.h"
Artem Titovd15a5752021-02-10 13:31:2417#include "api/sequence_checker.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0818#include "api/video/recordable_encoded_frame.h"
19#include "api/video/video_frame.h"
Niels Möllerc6ce9c52018-05-11 09:15:3020#include "api/video/video_sink_interface.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0821#include "api/video/video_source_interface.h"
Steve Anton10542f22019-01-11 17:11:0022#include "media/base/media_channel.h"
Tommi20d8d912022-02-08 20:12:1523#include "rtc_base/system/no_unique_address.h"
Mirko Bonadei3b56ee72018-10-15 15:15:1224#include "rtc_base/system/rtc_export.h"
ossu7bb87ee2017-01-23 12:56:2525
ossu7bb87ee2017-01-23 12:56:2526namespace webrtc {
27
Niels Möller5d67f822018-05-23 14:28:1728// VideoTrackSource is a convenience base class for implementations of
29// VideoTrackSourceInterface.
Mirko Bonadei3b56ee72018-10-15 15:15:1230class RTC_EXPORT VideoTrackSource : public Notifier<VideoTrackSourceInterface> {
ossu7bb87ee2017-01-23 12:56:2531 public:
Niels Möller5d67f822018-05-23 14:28:1732 explicit VideoTrackSource(bool remote);
ossu7bb87ee2017-01-23 12:56:2533 void SetState(SourceState new_state);
ossu7bb87ee2017-01-23 12:56:2534
Tommi20d8d912022-02-08 20:12:1535 SourceState state() const override {
36 RTC_DCHECK_RUN_ON(&signaling_thread_checker_);
37 return state_;
38 }
ossu7bb87ee2017-01-23 12:56:2539 bool remote() const override { return remote_; }
40
41 bool is_screencast() const override { return false; }
Danil Chapovalov66cadcc2018-06-19 14:47:4342 absl::optional<bool> needs_denoising() const override {
43 return absl::nullopt;
44 }
ossu7bb87ee2017-01-23 12:56:2545
46 bool GetStats(Stats* stats) override { return false; }
47
48 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
49 const rtc::VideoSinkWants& wants) override;
50 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override;
51
Markus Handell6efc14b2020-05-05 18:11:1352 bool SupportsEncodedOutput() const override { return false; }
53 void GenerateKeyFrame() override {}
54 void AddEncodedSink(
55 rtc::VideoSinkInterface<RecordableEncodedFrame>* sink) override {}
56 void RemoveEncodedSink(
57 rtc::VideoSinkInterface<RecordableEncodedFrame>* sink) override {}
58
Niels Möller5d67f822018-05-23 14:28:1759 protected:
Niels Möllerc17ca532018-05-31 13:36:4960 virtual rtc::VideoSourceInterface<VideoFrame>* source() = 0;
Niels Möller5d67f822018-05-23 14:28:1761
ossu7bb87ee2017-01-23 12:56:2562 private:
Tommi20d8d912022-02-08 20:12:1563 RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_thread_checker_;
64 RTC_NO_UNIQUE_ADDRESS SequenceChecker signaling_thread_checker_;
65 SourceState state_ RTC_GUARDED_BY(&signaling_thread_checker_);
ossu7bb87ee2017-01-23 12:56:2566 const bool remote_;
67};
68
69} // namespace webrtc
70
Steve Anton10542f22019-01-11 17:11:0071#endif // PC_VIDEO_TRACK_SOURCE_H_