blob: fb6c7be52b99a9f2307416a23394c153e670b0c3 [file] [log] [blame]
ossu7bb87ee2017-01-23 04:56:25 -08001/*
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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef PC_VIDEOTRACKSOURCE_H_
12#define PC_VIDEOTRACKSOURCE_H_
ossu7bb87ee2017-01-23 04:56:25 -080013
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020014#include "api/mediastreaminterface.h"
15#include "api/notifier.h"
Niels Möllerc6ce9c52018-05-11 11:15:30 +020016#include "api/video/video_sink_interface.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "media/base/mediachannel.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020018#include "rtc_base/thread_checker.h"
ossu7bb87ee2017-01-23 04:56:25 -080019
ossu7bb87ee2017-01-23 04:56:25 -080020namespace webrtc {
21
Niels Möller5d67f822018-05-23 16:28:17 +020022// VideoTrackSource is a convenience base class for implementations of
23// VideoTrackSourceInterface.
ossu7bb87ee2017-01-23 04:56:25 -080024class VideoTrackSource : public Notifier<VideoTrackSourceInterface> {
25 public:
Niels Möller5d67f822018-05-23 16:28:17 +020026 explicit VideoTrackSource(bool remote);
ossu7bb87ee2017-01-23 04:56:25 -080027 void SetState(SourceState new_state);
ossu7bb87ee2017-01-23 04:56:25 -080028
29 SourceState state() const override { return state_; }
30 bool remote() const override { return remote_; }
31
32 bool is_screencast() const override { return false; }
Oskar Sundbom36f8f3e2017-11-16 10:54:27 +010033 rtc::Optional<bool> needs_denoising() const override { return rtc::nullopt; }
ossu7bb87ee2017-01-23 04:56:25 -080034
35 bool GetStats(Stats* stats) override { return false; }
36
37 void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
38 const rtc::VideoSinkWants& wants) override;
39 void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override;
40
Niels Möller5d67f822018-05-23 16:28:17 +020041 protected:
Niels Möllerc17ca532018-05-31 15:36:49 +020042 virtual rtc::VideoSourceInterface<VideoFrame>* source() = 0;
Niels Möller5d67f822018-05-23 16:28:17 +020043
ossu7bb87ee2017-01-23 04:56:25 -080044 private:
45 rtc::ThreadChecker worker_thread_checker_;
ossu7bb87ee2017-01-23 04:56:25 -080046 SourceState state_;
47 const bool remote_;
48};
49
50} // namespace webrtc
51
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020052#endif // PC_VIDEOTRACKSOURCE_H_