2017-01-23 04:56:25 -08:00
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-01-11 09:11:00 -08:00
|
|
|
#ifndef PC_VIDEO_TRACK_SOURCE_H_
|
|
|
|
|
#define PC_VIDEO_TRACK_SOURCE_H_
|
2017-01-23 04:56:25 -08:00
|
|
|
|
2021-01-29 14:45:08 +00:00
|
|
|
#include "absl/types/optional.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "api/media_stream_interface.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/notifier.h"
|
2021-02-10 14:31:24 +01:00
|
|
|
#include "api/sequence_checker.h"
|
2021-01-29 14:45:08 +00:00
|
|
|
#include "api/video/recordable_encoded_frame.h"
|
|
|
|
|
#include "api/video/video_frame.h"
|
2018-05-11 11:15:30 +02:00
|
|
|
#include "api/video/video_sink_interface.h"
|
2021-01-29 14:45:08 +00:00
|
|
|
#include "api/video/video_source_interface.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "media/base/media_channel.h"
|
2022-02-23 13:44:59 +00:00
|
|
|
#include "rtc_base/checks.h"
|
2022-02-08 21:12:15 +01:00
|
|
|
#include "rtc_base/system/no_unique_address.h"
|
2018-10-15 17:15:12 +02:00
|
|
|
#include "rtc_base/system/rtc_export.h"
|
2022-02-23 13:44:59 +00:00
|
|
|
#include "rtc_base/thread_annotations.h"
|
2017-01-23 04:56:25 -08:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2018-05-23 16:28:17 +02:00
|
|
|
// VideoTrackSource is a convenience base class for implementations of
|
|
|
|
|
// VideoTrackSourceInterface.
|
2018-10-15 17:15:12 +02:00
|
|
|
class RTC_EXPORT VideoTrackSource : public Notifier<VideoTrackSourceInterface> {
|
2017-01-23 04:56:25 -08:00
|
|
|
public:
|
2018-05-23 16:28:17 +02:00
|
|
|
explicit VideoTrackSource(bool remote);
|
2017-01-23 04:56:25 -08:00
|
|
|
void SetState(SourceState new_state);
|
|
|
|
|
|
2022-02-08 21:12:15 +01:00
|
|
|
SourceState state() const override {
|
|
|
|
|
RTC_DCHECK_RUN_ON(&signaling_thread_checker_);
|
|
|
|
|
return state_;
|
|
|
|
|
}
|
2017-01-23 04:56:25 -08:00
|
|
|
bool remote() const override { return remote_; }
|
|
|
|
|
|
|
|
|
|
bool is_screencast() const override { return false; }
|
2018-06-19 16:47:43 +02:00
|
|
|
absl::optional<bool> needs_denoising() const override {
|
|
|
|
|
return absl::nullopt;
|
|
|
|
|
}
|
2017-01-23 04:56:25 -08:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
2020-05-05 20:11:13 +02:00
|
|
|
bool SupportsEncodedOutput() const override { return false; }
|
|
|
|
|
void GenerateKeyFrame() override {}
|
|
|
|
|
void AddEncodedSink(
|
|
|
|
|
rtc::VideoSinkInterface<RecordableEncodedFrame>* sink) override {}
|
|
|
|
|
void RemoveEncodedSink(
|
|
|
|
|
rtc::VideoSinkInterface<RecordableEncodedFrame>* sink) override {}
|
|
|
|
|
|
2018-05-23 16:28:17 +02:00
|
|
|
protected:
|
2018-05-31 15:36:49 +02:00
|
|
|
virtual rtc::VideoSourceInterface<VideoFrame>* source() = 0;
|
2018-05-23 16:28:17 +02:00
|
|
|
|
2017-01-23 04:56:25 -08:00
|
|
|
private:
|
2022-02-08 21:12:15 +01:00
|
|
|
RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_thread_checker_;
|
|
|
|
|
RTC_NO_UNIQUE_ADDRESS SequenceChecker signaling_thread_checker_;
|
|
|
|
|
SourceState state_ RTC_GUARDED_BY(&signaling_thread_checker_);
|
2017-01-23 04:56:25 -08:00
|
|
|
const bool remote_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2019-01-11 09:11:00 -08:00
|
|
|
#endif // PC_VIDEO_TRACK_SOURCE_H_
|