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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef PC_VIDEOTRACKSOURCE_H_ |
| 12 | #define PC_VIDEOTRACKSOURCE_H_ |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 13 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 14 | #include "api/mediastreaminterface.h" |
| 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" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 17 | #include "media/base/mediachannel.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 18 | #include "rtc_base/thread_checker.h" |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 19 | |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 20 | namespace webrtc { |
| 21 | |
Niels Möller | 5d67f82 | 2018-05-23 16:28:17 +0200 | [diff] [blame] | 22 | // VideoTrackSource is a convenience base class for implementations of |
| 23 | // VideoTrackSourceInterface. |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 24 | class VideoTrackSource : public Notifier<VideoTrackSourceInterface> { |
| 25 | public: |
Niels Möller | 5d67f82 | 2018-05-23 16:28:17 +0200 | [diff] [blame] | 26 | explicit VideoTrackSource(bool remote); |
| 27 | // TODO(nisse): Delete, kept only for temporary backwards compatibility. |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 28 | VideoTrackSource(rtc::VideoSourceInterface<VideoFrame>* source, bool remote); |
| 29 | void SetState(SourceState new_state); |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 30 | |
| 31 | SourceState state() const override { return state_; } |
| 32 | bool remote() const override { return remote_; } |
| 33 | |
| 34 | bool is_screencast() const override { return false; } |
Oskar Sundbom | 36f8f3e | 2017-11-16 10:54:27 +0100 | [diff] [blame] | 35 | rtc::Optional<bool> needs_denoising() const override { return rtc::nullopt; } |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 36 | |
| 37 | bool GetStats(Stats* stats) override { return false; } |
| 38 | |
| 39 | void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, |
| 40 | const rtc::VideoSinkWants& wants) override; |
| 41 | void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override; |
| 42 | |
Niels Möller | 5d67f82 | 2018-05-23 16:28:17 +0200 | [diff] [blame] | 43 | protected: |
| 44 | // TODO(nisse): Default implementations for temporary backwards |
| 45 | // compatibility. |
| 46 | virtual rtc::VideoSourceInterface<VideoFrame>* source() { return source_; } |
| 47 | |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 48 | private: |
| 49 | rtc::ThreadChecker worker_thread_checker_; |
Niels Möller | 5d67f82 | 2018-05-23 16:28:17 +0200 | [diff] [blame] | 50 | // TODO(nisse): Delete, kept only for temporary backwards compatibility. |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 51 | rtc::VideoSourceInterface<VideoFrame>* source_; |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 52 | SourceState state_; |
| 53 | const bool remote_; |
| 54 | }; |
| 55 | |
| 56 | } // namespace webrtc |
| 57 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 58 | #endif // PC_VIDEOTRACKSOURCE_H_ |