aboutsummaryrefslogtreecommitdiff
path: root/pc/videotracksource.h
blob: 5ead399ff4bf3839ba01d1f7dd33d1467c7b50da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 *  Copyright 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef PC_VIDEOTRACKSOURCE_H_
#define PC_VIDEOTRACKSOURCE_H_

#include "api/mediastreaminterface.h"
#include "api/notifier.h"
#include "api/video/video_sink_interface.h"
#include "media/base/mediachannel.h"
#include "rtc_base/thread_checker.h"

// VideoTrackSource implements VideoTrackSourceInterface.
namespace webrtc {

class VideoTrackSource : public Notifier<VideoTrackSourceInterface> {
 public:
  VideoTrackSource(rtc::VideoSourceInterface<VideoFrame>* source, bool remote);
  void SetState(SourceState new_state);
  // OnSourceDestroyed clears this instance pointer to |source_|. It is useful
  // when the underlying rtc::VideoSourceInterface is destroyed before the
  // reference counted VideoTrackSource.
  void OnSourceDestroyed();

  SourceState state() const override { return state_; }
  bool remote() const override { return remote_; }

  bool is_screencast() const override { return false; }
  rtc::Optional<bool> needs_denoising() const override { return rtc::nullopt; }

  bool GetStats(Stats* stats) override { return false; }

  void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
                       const rtc::VideoSinkWants& wants) override;
  void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override;

 private:
  rtc::ThreadChecker worker_thread_checker_;
  rtc::VideoSourceInterface<VideoFrame>* source_;
  SourceState state_;
  const bool remote_;
};

}  // namespace webrtc

#endif  //  PC_VIDEOTRACKSOURCE_H_