blob: 330af2332e6ec500831a67c04d8e5c35a66fd5d2 [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:
nisseacd935b2016-11-11 03:55:13 -080025 VideoTrackSource(rtc::VideoSourceInterface<VideoFrame>* source, bool remote);
perkj0d3eef22016-03-09 02:39:17 +010026 void SetState(SourceState new_state);
perkjf0dcfe22016-03-10 18:32:00 +010027 // OnSourceDestroyed clears this instance pointer to |source_|. It is useful
28 // when the underlying rtc::VideoSourceInterface is destroyed before the
29 // reference counted VideoTrackSource.
30 void OnSourceDestroyed();
31
perkj0d3eef22016-03-09 02:39:17 +010032 SourceState state() const override { return state_; }
33 bool remote() const override { return remote_; }
34
nisseef8b61e2016-04-29 06:09:15 -070035 bool is_screencast() const override { return false; }
36 rtc::Optional<bool> needs_denoising() const override {
Perc0d31e92016-03-31 17:23:39 +020037 return rtc::Optional<bool>(); }
perkj0d3eef22016-03-09 02:39:17 +010038
nissefcc640f2016-04-01 01:10:42 -070039 bool GetStats(Stats* stats) override { return false; }
40
nisseacd935b2016-11-11 03:55:13 -080041 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
perkj0d3eef22016-03-09 02:39:17 +010042 const rtc::VideoSinkWants& wants) override;
nisseacd935b2016-11-11 03:55:13 -080043 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override;
perkj0d3eef22016-03-09 02:39:17 +010044
perkj0d3eef22016-03-09 02:39:17 +010045 private:
nisse5b68ab52016-04-07 07:45:54 -070046 rtc::ThreadChecker worker_thread_checker_;
nisseacd935b2016-11-11 03:55:13 -080047 rtc::VideoSourceInterface<VideoFrame>* source_;
perkj0d3eef22016-03-09 02:39:17 +010048 cricket::VideoOptions options_;
49 SourceState state_;
50 const bool remote_;
51};
52
53} // namespace webrtc
perkj11e18052016-03-07 22:03:23 +010054
55#endif // WEBRTC_API_VIDEOTRACKSOURCE_H_