blob: 75ea4ba225ca348fbf5a6ba81c33312fafe54400 [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
Florent Castelli8037fc62024-08-29 13:00:4014#include <optional>
15
Steve Anton10542f22019-01-11 17:11:0016#include "api/media_stream_interface.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3117#include "api/notifier.h"
Artem Titovd15a5752021-02-10 13:31:2418#include "api/sequence_checker.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0819#include "api/video/recordable_encoded_frame.h"
20#include "api/video/video_frame.h"
Niels Möllerc6ce9c52018-05-11 09:15:3021#include "api/video/video_sink_interface.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0822#include "api/video/video_source_interface.h"
Steve Anton10542f22019-01-11 17:11:0023#include "media/base/media_channel.h"
Harald Alvestrandc24a2182022-02-23 13:44:5924#include "rtc_base/checks.h"
Tommi20d8d912022-02-08 20:12:1525#include "rtc_base/system/no_unique_address.h"
Mirko Bonadei3b56ee72018-10-15 15:15:1226#include "rtc_base/system/rtc_export.h"
Harald Alvestrandc24a2182022-02-23 13:44:5927#include "rtc_base/thread_annotations.h"
ossu7bb87ee2017-01-23 12:56:2528
ossu7bb87ee2017-01-23 12:56:2529namespace webrtc {
30
Niels Möller5d67f822018-05-23 14:28:1731// VideoTrackSource is a convenience base class for implementations of
32// VideoTrackSourceInterface.
Mirko Bonadei3b56ee72018-10-15 15:15:1233class RTC_EXPORT VideoTrackSource : public Notifier<VideoTrackSourceInterface> {
ossu7bb87ee2017-01-23 12:56:2534 public:
Niels Möller5d67f822018-05-23 14:28:1735 explicit VideoTrackSource(bool remote);
ossu7bb87ee2017-01-23 12:56:2536 void SetState(SourceState new_state);
ossu7bb87ee2017-01-23 12:56:2537
Tommi20d8d912022-02-08 20:12:1538 SourceState state() const override {
39 RTC_DCHECK_RUN_ON(&signaling_thread_checker_);
40 return state_;
41 }
ossu7bb87ee2017-01-23 12:56:2542 bool remote() const override { return remote_; }
43
44 bool is_screencast() const override { return false; }
Florent Castelli8037fc62024-08-29 13:00:4045 std::optional<bool> needs_denoising() const override { return std::nullopt; }
ossu7bb87ee2017-01-23 12:56:2546
47 bool GetStats(Stats* stats) override { return false; }
48
49 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
50 const rtc::VideoSinkWants& wants) override;
51 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override;
52
Markus Handell6efc14b2020-05-05 18:11:1353 bool SupportsEncodedOutput() const override { return false; }
54 void GenerateKeyFrame() override {}
55 void AddEncodedSink(
56 rtc::VideoSinkInterface<RecordableEncodedFrame>* sink) override {}
57 void RemoveEncodedSink(
58 rtc::VideoSinkInterface<RecordableEncodedFrame>* sink) override {}
59
Niels Möller5d67f822018-05-23 14:28:1760 protected:
Niels Möllerc17ca532018-05-31 13:36:4961 virtual rtc::VideoSourceInterface<VideoFrame>* source() = 0;
Niels Möller5d67f822018-05-23 14:28:1762
ossu7bb87ee2017-01-23 12:56:2563 private:
Tommic8482682023-03-23 21:20:3964 RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_thread_checker_{
65 SequenceChecker::kDetached};
Tommi20d8d912022-02-08 20:12:1566 RTC_NO_UNIQUE_ADDRESS SequenceChecker signaling_thread_checker_;
67 SourceState state_ RTC_GUARDED_BY(&signaling_thread_checker_);
ossu7bb87ee2017-01-23 12:56:2568 const bool remote_;
69};
70
71} // namespace webrtc
72
Steve Anton10542f22019-01-11 17:11:0073#endif // PC_VIDEO_TRACK_SOURCE_H_