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" |
| 16 | #include "media/base/mediachannel.h" |
| 17 | #include "media/base/videosinkinterface.h" |
| 18 | #include "rtc_base/thread_checker.h" |
ossu | 7bb87ee | 2017-01-23 04:56:25 -0800 | [diff] [blame] | 19 | |
| 20 | // VideoTrackSource implements VideoTrackSourceInterface. |
| 21 | namespace webrtc { |
| 22 | |
| 23 | class VideoTrackSource : public Notifier<VideoTrackSourceInterface> { |
| 24 | public: |
| 25 | VideoTrackSource(rtc::VideoSourceInterface<VideoFrame>* source, bool remote); |
| 26 | void SetState(SourceState new_state); |
| 27 | // OnSourceDestroyed clears this instance pointer to |source_|. It is useful |
| 28 | // when the underlying rtc::VideoSourceInterface is destroyed before the |
| 29 | // reference counted VideoTrackSource. |
| 30 | void OnSourceDestroyed(); |
| 31 | |
| 32 | SourceState state() const override { return state_; } |
| 33 | bool remote() const override { return remote_; } |
| 34 | |
| 35 | bool is_screencast() const override { return false; } |
| 36 | rtc::Optional<bool> needs_denoising() const override { |
| 37 | return rtc::Optional<bool>(); } |
| 38 | |
| 39 | bool GetStats(Stats* stats) override { return false; } |
| 40 | |
| 41 | void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, |
| 42 | const rtc::VideoSinkWants& wants) override; |
| 43 | void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override; |
| 44 | |
| 45 | private: |
| 46 | rtc::ThreadChecker worker_thread_checker_; |
| 47 | rtc::VideoSourceInterface<VideoFrame>* source_; |
| 48 | cricket::VideoOptions options_; |
| 49 | SourceState state_; |
| 50 | const bool remote_; |
| 51 | }; |
| 52 | |
| 53 | } // namespace webrtc |
| 54 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 55 | #endif // PC_VIDEOTRACKSOURCE_H_ |