video_track_source.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #ifndef PC_VIDEO_TRACK_SOURCE_H_
  11. #define PC_VIDEO_TRACK_SOURCE_H_
  12. #include "api/media_stream_interface.h"
  13. #include "api/notifier.h"
  14. #include "api/video/video_sink_interface.h"
  15. #include "media/base/media_channel.h"
  16. #include "rtc_base/system/rtc_export.h"
  17. #include "rtc_base/thread_checker.h"
  18. namespace webrtc {
  19. // VideoTrackSource is a convenience base class for implementations of
  20. // VideoTrackSourceInterface.
  21. class RTC_EXPORT VideoTrackSource : public Notifier<VideoTrackSourceInterface> {
  22. public:
  23. explicit VideoTrackSource(bool remote);
  24. void SetState(SourceState new_state);
  25. SourceState state() const override { return state_; }
  26. bool remote() const override { return remote_; }
  27. bool is_screencast() const override { return false; }
  28. absl::optional<bool> needs_denoising() const override {
  29. return absl::nullopt;
  30. }
  31. bool GetStats(Stats* stats) override { return false; }
  32. void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
  33. const rtc::VideoSinkWants& wants) override;
  34. void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override;
  35. bool SupportsEncodedOutput() const override { return false; }
  36. void GenerateKeyFrame() override {}
  37. void AddEncodedSink(
  38. rtc::VideoSinkInterface<RecordableEncodedFrame>* sink) override {}
  39. void RemoveEncodedSink(
  40. rtc::VideoSinkInterface<RecordableEncodedFrame>* sink) override {}
  41. protected:
  42. virtual rtc::VideoSourceInterface<VideoFrame>* source() = 0;
  43. private:
  44. rtc::ThreadChecker worker_thread_checker_;
  45. SourceState state_;
  46. const bool remote_;
  47. };
  48. } // namespace webrtc
  49. #endif // PC_VIDEO_TRACK_SOURCE_H_