blob: 3d8d502c8f265f16f47659216f872306a36d8958 [file] [log] [blame]
perkj11e18052016-03-07 22:03:23 +01001/*
perkj11e18052016-03-07 22:03:23 +01002 * 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 WEBRTC_API_VIDEOTRACKSOURCE_H_
12#define WEBRTC_API_VIDEOTRACKSOURCE_H_
13
perkj9e083d22016-03-20 09:38:40 -070014#include "webrtc/api/mediastreaminterface.h"
perkj0d3eef22016-03-09 02:39:17 +010015#include "webrtc/api/notifier.h"
nisse5b68ab52016-04-07 07:45:54 -070016#include "webrtc/base/thread_checker.h"
perkj0d3eef22016-03-09 02:39:17 +010017#include "webrtc/media/base/mediachannel.h"
18#include "webrtc/media/base/videosinkinterface.h"
19
20// VideoTrackSource implements VideoTrackSourceInterface.
21namespace webrtc {
22
23class VideoTrackSource : public Notifier<VideoTrackSourceInterface> {
24 public:
25 VideoTrackSource(rtc::VideoSourceInterface<cricket::VideoFrame>* source,
perkj0d3eef22016-03-09 02:39:17 +010026 bool remote);
perkj0d3eef22016-03-09 02:39:17 +010027 void SetState(SourceState new_state);
perkjf0dcfe22016-03-10 18:32:00 +010028 // OnSourceDestroyed clears this instance pointer to |source_|. It is useful
29 // when the underlying rtc::VideoSourceInterface is destroyed before the
30 // reference counted VideoTrackSource.
31 void OnSourceDestroyed();
32
perkj0d3eef22016-03-09 02:39:17 +010033 SourceState state() const override { return state_; }
34 bool remote() const override { return remote_; }
35
36 void Stop() override{};
37 void Restart() override{};
38
perkjf0dcfe22016-03-10 18:32:00 +010039 virtual bool is_screencast() const { return false; }
Perc0d31e92016-03-31 17:23:39 +020040 virtual rtc::Optional<bool> needs_denoising() const {
41 return rtc::Optional<bool>(); }
perkj0d3eef22016-03-09 02:39:17 +010042
nissefcc640f2016-04-01 01:10:42 -070043 bool GetStats(Stats* stats) override { return false; }
44
perkj0d3eef22016-03-09 02:39:17 +010045 void AddOrUpdateSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink,
46 const rtc::VideoSinkWants& wants) override;
47 void RemoveSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override;
48
perkjf0dcfe22016-03-10 18:32:00 +010049 cricket::VideoCapturer* GetVideoCapturer() override { return nullptr; }
50
perkj0d3eef22016-03-09 02:39:17 +010051 private:
nisse5b68ab52016-04-07 07:45:54 -070052 rtc::ThreadChecker worker_thread_checker_;
perkj0d3eef22016-03-09 02:39:17 +010053 rtc::VideoSourceInterface<cricket::VideoFrame>* source_;
perkj0d3eef22016-03-09 02:39:17 +010054 cricket::VideoOptions options_;
55 SourceState state_;
56 const bool remote_;
57};
58
59} // namespace webrtc
perkj11e18052016-03-07 22:03:23 +010060
61#endif // WEBRTC_API_VIDEOTRACKSOURCE_H_