blob: 27331eac4fed805d93c00c8a9b7f8c3979d56a43 [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
Steve Anton10542f22019-01-11 17:11:0014#include "api/media_stream_interface.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3115#include "api/notifier.h"
Niels Möllerc6ce9c52018-05-11 09:15:3016#include "api/video/video_sink_interface.h"
Steve Anton10542f22019-01-11 17:11:0017#include "media/base/media_channel.h"
Mirko Bonadei3b56ee72018-10-15 15:15:1218#include "rtc_base/system/rtc_export.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3119#include "rtc_base/thread_checker.h"
ossu7bb87ee2017-01-23 12:56:2520
ossu7bb87ee2017-01-23 12:56:2521namespace webrtc {
22
Niels Möller5d67f822018-05-23 14:28:1723// VideoTrackSource is a convenience base class for implementations of
24// VideoTrackSourceInterface.
Mirko Bonadei3b56ee72018-10-15 15:15:1225class RTC_EXPORT VideoTrackSource : public Notifier<VideoTrackSourceInterface> {
ossu7bb87ee2017-01-23 12:56:2526 public:
Niels Möller5d67f822018-05-23 14:28:1727 explicit VideoTrackSource(bool remote);
ossu7bb87ee2017-01-23 12:56:2528 void SetState(SourceState new_state);
ossu7bb87ee2017-01-23 12:56:2529
30 SourceState state() const override { return state_; }
31 bool remote() const override { return remote_; }
32
33 bool is_screencast() const override { return false; }
Danil Chapovalov66cadcc2018-06-19 14:47:4334 absl::optional<bool> needs_denoising() const override {
35 return absl::nullopt;
36 }
ossu7bb87ee2017-01-23 12:56:2537
38 bool GetStats(Stats* stats) override { return false; }
39
40 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
41 const rtc::VideoSinkWants& wants) override;
42 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override;
43
Markus Handell6efc14b2020-05-05 18:11:1344 bool SupportsEncodedOutput() const override { return false; }
45 void GenerateKeyFrame() override {}
46 void AddEncodedSink(
47 rtc::VideoSinkInterface<RecordableEncodedFrame>* sink) override {}
48 void RemoveEncodedSink(
49 rtc::VideoSinkInterface<RecordableEncodedFrame>* sink) override {}
50
Niels Möller5d67f822018-05-23 14:28:1751 protected:
Niels Möllerc17ca532018-05-31 13:36:4952 virtual rtc::VideoSourceInterface<VideoFrame>* source() = 0;
Niels Möller5d67f822018-05-23 14:28:1753
ossu7bb87ee2017-01-23 12:56:2554 private:
55 rtc::ThreadChecker worker_thread_checker_;
ossu7bb87ee2017-01-23 12:56:2556 SourceState state_;
57 const bool remote_;
58};
59
60} // namespace webrtc
61
Steve Anton10542f22019-01-11 17:11:0062#endif // PC_VIDEO_TRACK_SOURCE_H_