ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 1 | /* |
| 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 Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 11 | #ifndef PC_VIDEO_TRACK_SOURCE_H_ |
| 12 | #define PC_VIDEO_TRACK_SOURCE_H_ |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 13 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 14 | #include "api/media_stream_interface.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 15 | #include "api/notifier.h" |
Niels Möller | c6ce9c5 | 2018-05-11 11:15:30 +0200 | [diff] [blame] | 16 | #include "api/video/video_sink_interface.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 17 | #include "media/base/media_channel.h" |
Mirko Bonadei | 3b56ee7 | 2018-10-15 17:15:12 +0200 | [diff] [blame] | 18 | #include "rtc_base/system/rtc_export.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 19 | #include "rtc_base/thread_checker.h" |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 20 | |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 21 | namespace webrtc { |
| 22 | |
Niels Möller | 5d67f82 | 2018-05-23 16:28:17 +0200 | [diff] [blame] | 23 | // VideoTrackSource is a convenience base class for implementations of |
| 24 | // VideoTrackSourceInterface. |
Mirko Bonadei | 3b56ee7 | 2018-10-15 17:15:12 +0200 | [diff] [blame] | 25 | class RTC_EXPORT VideoTrackSource : public Notifier<VideoTrackSourceInterface> { |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 26 | public: |
Niels Möller | 5d67f82 | 2018-05-23 16:28:17 +0200 | [diff] [blame] | 27 | explicit VideoTrackSource(bool remote); |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 28 | void SetState(SourceState new_state); |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 29 | |
| 30 | SourceState state() const override { return state_; } |
| 31 | bool remote() const override { return remote_; } |
| 32 | |
| 33 | bool is_screencast() const override { return false; } |
Danil Chapovalov | 66cadcc | 2018-06-19 16:47:43 +0200 | [diff] [blame] | 34 | absl::optional<bool> needs_denoising() const override { |
| 35 | return absl::nullopt; |
| 36 | } |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 37 | |
| 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 | |
Niels Möller | 5d67f82 | 2018-05-23 16:28:17 +0200 | [diff] [blame] | 44 | protected: |
Niels Möller | c17ca53 | 2018-05-31 15:36:49 +0200 | [diff] [blame] | 45 | virtual rtc::VideoSourceInterface<VideoFrame>* source() = 0; |
Niels Möller | 5d67f82 | 2018-05-23 16:28:17 +0200 | [diff] [blame] | 46 | |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 47 | private: |
| 48 | rtc::ThreadChecker worker_thread_checker_; |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 49 | SourceState state_; |
| 50 | const bool remote_; |
| 51 | }; |
| 52 | |
| 53 | } // namespace webrtc |
| 54 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 55 | #endif // PC_VIDEO_TRACK_SOURCE_H_ |