You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.7 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. protected:
  36. virtual rtc::VideoSourceInterface<VideoFrame>* source() = 0;
  37. private:
  38. rtc::ThreadChecker worker_thread_checker_;
  39. SourceState state_;
  40. const bool remote_;
  41. };
  42. } // namespace webrtc
  43. #endif // PC_VIDEO_TRACK_SOURCE_H_