| 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 |
| 11 | #ifndef PC_VIDEO_TRACK_SOURCE_H_ |
| 12 | #define PC_VIDEO_TRACK_SOURCE_H_ |
| 13 |
| 14 | #include "absl/types/optional.h" |
| 15 | #include "api/media_stream_interface.h" |
| 16 | #include "api/notifier.h" |
| 17 | #include "api/sequence_checker.h" |
| 18 | #include "api/video/recordable_encoded_frame.h" |
| 19 | #include "api/video/video_frame.h" |
| 20 | #include "api/video/video_sink_interface.h" |
| 21 | #include "api/video/video_source_interface.h" |
| 22 | #include "media/base/media_channel.h" |
| 23 | #include "rtc_base/checks.h" |
| 24 | #include "rtc_base/system/no_unique_address.h" |
| 25 | #include "rtc_base/system/rtc_export.h" |
| 26 | #include "rtc_base/thread_annotations.h" |
| 27 |
| 28 | namespace webrtc { |
| 29 |
| 30 | // VideoTrackSource is a convenience base class for implementations of |
| 31 | // VideoTrackSourceInterface. |
| 32 | class RTC_EXPORT VideoTrackSource : public Notifier<VideoTrackSourceInterface> { |
| 33 | public: |
| 34 | explicit VideoTrackSource(bool remote); |
| 35 | void SetState(SourceState new_state); |
| 36 |
| 37 | SourceState state() const override { |
| 38 | RTC_DCHECK_RUN_ON(&signaling_thread_checker_); |
| 39 | return state_; |
| 40 | } |
| 41 | bool remote() const override { return remote_; } |
| 42 |
| 43 | bool is_screencast() const override { return false; } |
| 44 | absl::optional<bool> needs_denoising() const override { |
| 45 | return absl::nullopt; |
| 46 | } |
| 47 |
| 48 | bool GetStats(Stats* stats) override { return false; } |
| 49 |
| 50 | void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, |
| 51 | const rtc::VideoSinkWants& wants) override; |
| 52 | void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override; |
| 53 |
| 54 | bool SupportsEncodedOutput() const override { return false; } |
| 55 | void GenerateKeyFrame() override {} |
| 56 | void AddEncodedSink( |
| 57 | rtc::VideoSinkInterface<RecordableEncodedFrame>* sink) override {} |
| 58 | void RemoveEncodedSink( |
| 59 | rtc::VideoSinkInterface<RecordableEncodedFrame>* sink) override {} |
| 60 |
| 61 | protected: |
| 62 | virtual rtc::VideoSourceInterface<VideoFrame>* source() = 0; |
| 63 |
| 64 | private: |
| 65 | RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_thread_checker_{ |
| 66 | SequenceChecker::kDetached}; |
| 67 | RTC_NO_UNIQUE_ADDRESS SequenceChecker signaling_thread_checker_; |
| 68 | SourceState state_ RTC_GUARDED_BY(&signaling_thread_checker_); |
| 69 | const bool remote_; |
| 70 | }; |
| 71 |
| 72 | } // namespace webrtc |
| 73 |
| 74 | #endif // PC_VIDEO_TRACK_SOURCE_H_ |
| 75 |