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