Replace VideoSourceInterface with FrameGeneratorInterface in AddVideoConfig
Replace VideoSourceInterface with FrameGeneratorInterface in AddVideoConfig in PC quality test fixture. Bug: webrtc:10138 Change-Id: I6e5fe91d286e0360bfcad1785af1fb1d8f890563 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161239 Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30012}
This commit is contained in:
parent
fd76b5fe86
commit
0020226e63
@ -353,6 +353,7 @@ rtc_source_set("peer_connection_quality_test_fixture_api") {
|
||||
":audio_quality_analyzer_api",
|
||||
":callfactory_api",
|
||||
":fec_controller_api",
|
||||
":frame_generator_api",
|
||||
":function_view",
|
||||
":libjingle_peerconnection_api",
|
||||
":network_state_predictor_api",
|
||||
|
||||
@ -25,13 +25,13 @@
|
||||
#include "api/rtc_event_log/rtc_event_log_factory_interface.h"
|
||||
#include "api/task_queue/task_queue_factory.h"
|
||||
#include "api/test/audio_quality_analyzer_interface.h"
|
||||
#include "api/test/frame_generator_interface.h"
|
||||
#include "api/test/simulated_network.h"
|
||||
#include "api/test/stats_observer_interface.h"
|
||||
#include "api/test/video_quality_analyzer_interface.h"
|
||||
#include "api/transport/media/media_transport_interface.h"
|
||||
#include "api/transport/network_control.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "api/video/video_source_interface.h"
|
||||
#include "api/video_codecs/video_decoder_factory.h"
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
#include "api/video_codecs/video_encoder_factory.h"
|
||||
@ -292,10 +292,10 @@ class PeerConnectionE2EQualityTestFixture {
|
||||
// Add new video stream to the call that will be sent from this peer.
|
||||
virtual PeerConfigurer* AddVideoConfig(VideoConfig config) = 0;
|
||||
// Add new video stream to the call that will be sent from this peer with
|
||||
// provided own implementation of video frames source.
|
||||
// provided own implementation of video frames generator.
|
||||
virtual PeerConfigurer* AddVideoConfig(
|
||||
VideoConfig config,
|
||||
std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>> source) = 0;
|
||||
std::unique_ptr<test::FrameGeneratorInterface> generator) = 0;
|
||||
// Set the audio stream for the call from this peer. If this method won't
|
||||
// be invoked, this peer will send no audio.
|
||||
virtual PeerConfigurer* SetAudioConfig(AudioConfig config) = 0;
|
||||
|
||||
@ -177,19 +177,6 @@ rtc_library("quality_analyzing_video_encoder") {
|
||||
]
|
||||
}
|
||||
|
||||
rtc_library("video_source_based_video_capturer") {
|
||||
visibility = [ "*" ]
|
||||
testonly = true
|
||||
sources = [
|
||||
"video_source_based_video_capturer.cc",
|
||||
"video_source_based_video_capturer.h",
|
||||
]
|
||||
deps = [
|
||||
"../..:video_test_common",
|
||||
"../../../api/video:video_frame",
|
||||
]
|
||||
}
|
||||
|
||||
if (rtc_include_tests) {
|
||||
rtc_library("video_quality_analyzer_injection_helper") {
|
||||
visibility = [ "*" ]
|
||||
@ -242,6 +229,7 @@ if (rtc_include_tests) {
|
||||
":echo_emulation",
|
||||
":peer_connection_quality_test_params",
|
||||
":video_quality_analyzer_injection_helper",
|
||||
"../../../api:frame_generator_api",
|
||||
"../../../api:peer_connection_quality_test_fixture_api",
|
||||
"../../../api:scoped_refptr",
|
||||
"../../../api/rtc_event_log:rtc_event_log_factory",
|
||||
@ -287,7 +275,6 @@ if (rtc_include_tests) {
|
||||
":stats_poller",
|
||||
":test_peer",
|
||||
":video_quality_analyzer_injection_helper",
|
||||
":video_source_based_video_capturer",
|
||||
"../..:field_trial",
|
||||
"../..:platform_video_capturer",
|
||||
"../..:video_test_common",
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
#include "test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.h"
|
||||
#include "test/pc/e2e/analyzer/video/default_video_quality_analyzer.h"
|
||||
#include "test/pc/e2e/stats_poller.h"
|
||||
#include "test/pc/e2e/video_source_based_video_capturer.h"
|
||||
#include "test/platform_video_capturer.h"
|
||||
#include "test/testsupport/file_utils.h"
|
||||
|
||||
@ -65,7 +64,9 @@ constexpr int kQuickTestModeRunDurationMs = 100;
|
||||
constexpr char kFlexFecEnabledFieldTrials[] =
|
||||
"WebRTC-FlexFEC-03-Advertised/Enabled/WebRTC-FlexFEC-03/Enabled/";
|
||||
|
||||
std::string VideoConfigSourcePresenceToString(const VideoConfig& video_config) {
|
||||
std::string VideoConfigSourcePresenceToString(
|
||||
const VideoConfig& video_config,
|
||||
bool has_user_provided_generator) {
|
||||
char buf[1024];
|
||||
rtc::SimpleStringBuilder builder(buf);
|
||||
builder << "video_config.generator=" << video_config.generator.has_value()
|
||||
@ -74,7 +75,9 @@ std::string VideoConfigSourcePresenceToString(const VideoConfig& video_config) {
|
||||
<< "; video_config.screen_share_config="
|
||||
<< video_config.screen_share_config.has_value()
|
||||
<< "; video_config.capturing_device_index="
|
||||
<< video_config.capturing_device_index.has_value() << ";";
|
||||
<< video_config.capturing_device_index.has_value()
|
||||
<< "; has_user_provided_generator=" << has_user_provided_generator
|
||||
<< ";";
|
||||
return builder.str();
|
||||
}
|
||||
|
||||
@ -236,19 +239,21 @@ void PeerConnectionE2EQualityTest::Run(RunParams run_params) {
|
||||
peer_configurations_[0]->ReleaseParams();
|
||||
std::unique_ptr<InjectableComponents> alice_components =
|
||||
peer_configurations_[0]->ReleaseComponents();
|
||||
std::vector<std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>>>
|
||||
alice_video_sources = peer_configurations_[0]->ReleaseVideoSources();
|
||||
std::vector<std::unique_ptr<test::FrameGeneratorInterface>>
|
||||
alice_video_generators =
|
||||
peer_configurations_[0]->ReleaseVideoGenerators();
|
||||
std::unique_ptr<Params> bob_params = peer_configurations_[1]->ReleaseParams();
|
||||
std::unique_ptr<InjectableComponents> bob_components =
|
||||
peer_configurations_[1]->ReleaseComponents();
|
||||
std::vector<std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>>>
|
||||
bob_video_sources = peer_configurations_[1]->ReleaseVideoSources();
|
||||
std::vector<std::unique_ptr<test::FrameGeneratorInterface>>
|
||||
bob_video_generators = peer_configurations_[1]->ReleaseVideoGenerators();
|
||||
peer_configurations_.clear();
|
||||
|
||||
SetDefaultValuesForMissingParams({alice_params.get(), bob_params.get()},
|
||||
{&alice_video_sources, &bob_video_sources});
|
||||
SetDefaultValuesForMissingParams(
|
||||
{alice_params.get(), bob_params.get()},
|
||||
{&alice_video_generators, &bob_video_generators});
|
||||
ValidateParams(run_params, {alice_params.get(), bob_params.get()},
|
||||
{&alice_video_sources, &bob_video_sources});
|
||||
{&alice_video_generators, &bob_video_generators});
|
||||
SetupRequiredFieldTrials(run_params);
|
||||
|
||||
// Print test summary
|
||||
@ -281,7 +286,7 @@ void PeerConnectionE2EQualityTest::Run(RunParams run_params) {
|
||||
|
||||
alice_ = TestPeer::CreateTestPeer(
|
||||
std::move(alice_components), std::move(alice_params),
|
||||
std::move(alice_video_sources),
|
||||
std::move(alice_video_generators),
|
||||
std::make_unique<FixturePeerConnectionObserver>(
|
||||
[this, bob_video_configs](
|
||||
rtc::scoped_refptr<RtpTransceiverInterface> transceiver) {
|
||||
@ -293,7 +298,7 @@ void PeerConnectionE2EQualityTest::Run(RunParams run_params) {
|
||||
run_params.echo_emulation_config, task_queue_.get());
|
||||
bob_ = TestPeer::CreateTestPeer(
|
||||
std::move(bob_components), std::move(bob_params),
|
||||
std::move(bob_video_sources),
|
||||
std::move(bob_video_generators),
|
||||
std::make_unique<FixturePeerConnectionObserver>(
|
||||
[this, alice_video_configs](
|
||||
rtc::scoped_refptr<RtpTransceiverInterface> transceiver) {
|
||||
@ -448,9 +453,8 @@ void PeerConnectionE2EQualityTest::Run(RunParams run_params) {
|
||||
|
||||
void PeerConnectionE2EQualityTest::SetDefaultValuesForMissingParams(
|
||||
std::vector<Params*> params,
|
||||
std::vector<
|
||||
std::vector<std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>>>*>
|
||||
video_sources) {
|
||||
std::vector<std::vector<std::unique_ptr<test::FrameGeneratorInterface>>*>
|
||||
video_generators) {
|
||||
int video_counter = 0;
|
||||
int audio_counter = 0;
|
||||
std::set<std::string> video_labels;
|
||||
@ -459,11 +463,11 @@ void PeerConnectionE2EQualityTest::SetDefaultValuesForMissingParams(
|
||||
auto* p = params[i];
|
||||
for (size_t j = 0; j < p->video_configs.size(); ++j) {
|
||||
VideoConfig& video_config = p->video_configs[j];
|
||||
std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>>& video_source =
|
||||
(*video_sources[i])[j];
|
||||
std::unique_ptr<test::FrameGeneratorInterface>& video_generator =
|
||||
(*video_generators[i])[j];
|
||||
if (!video_config.generator && !video_config.input_file_name &&
|
||||
!video_config.screen_share_config &&
|
||||
!video_config.capturing_device_index && !video_source) {
|
||||
!video_config.capturing_device_index && !video_generator) {
|
||||
video_config.generator = VideoGeneratorType::kDefault;
|
||||
}
|
||||
if (!video_config.stream_label) {
|
||||
@ -491,9 +495,8 @@ void PeerConnectionE2EQualityTest::SetDefaultValuesForMissingParams(
|
||||
void PeerConnectionE2EQualityTest::ValidateParams(
|
||||
const RunParams& run_params,
|
||||
std::vector<Params*> params,
|
||||
std::vector<
|
||||
std::vector<std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>>>*>
|
||||
video_sources) {
|
||||
std::vector<std::vector<std::unique_ptr<test::FrameGeneratorInterface>>*>
|
||||
video_generators) {
|
||||
RTC_CHECK_GT(run_params.video_encoder_bitrate_multiplier, 0.0);
|
||||
|
||||
std::set<std::string> video_labels;
|
||||
@ -526,11 +529,12 @@ void PeerConnectionE2EQualityTest::ValidateParams(
|
||||
++input_sources_count;
|
||||
if (video_config.capturing_device_index)
|
||||
++input_sources_count;
|
||||
if ((*video_sources[i])[j])
|
||||
if ((*video_generators[i])[j])
|
||||
++input_sources_count;
|
||||
|
||||
RTC_CHECK_EQ(input_sources_count, 1)
|
||||
<< VideoConfigSourcePresenceToString(video_config);
|
||||
// TODO(titovartem) handle video_generators case properly
|
||||
RTC_CHECK_EQ(input_sources_count, 1) << VideoConfigSourcePresenceToString(
|
||||
video_config, (*video_generators[i])[j] != nullptr);
|
||||
|
||||
if (video_config.screen_share_config) {
|
||||
if (video_config.screen_share_config->slides_yuv_file_names.empty()) {
|
||||
@ -733,7 +737,7 @@ PeerConnectionE2EQualityTest::MaybeAddVideo(TestPeer* peer) {
|
||||
test::VideoFrameWriter* writer =
|
||||
MaybeCreateVideoWriter(video_config.input_dump_file_name, video_config);
|
||||
std::unique_ptr<test::TestVideoCapturer> capturer = CreateVideoCapturer(
|
||||
video_config, peer->ReleaseVideoSource(i),
|
||||
video_config, peer->ReleaseVideoGenerator(i),
|
||||
video_quality_analyzer_injection_helper_->CreateFramePreprocessor(
|
||||
video_config, writer));
|
||||
rtc::scoped_refptr<TestVideoCapturerVideoTrackSource> source =
|
||||
@ -770,7 +774,7 @@ PeerConnectionE2EQualityTest::MaybeAddVideo(TestPeer* peer) {
|
||||
std::unique_ptr<test::TestVideoCapturer>
|
||||
PeerConnectionE2EQualityTest::CreateVideoCapturer(
|
||||
const VideoConfig& video_config,
|
||||
std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>> source,
|
||||
std::unique_ptr<test::FrameGeneratorInterface> generator,
|
||||
std::unique_ptr<test::TestVideoCapturer::FramePreprocessor>
|
||||
frame_preprocessor) {
|
||||
if (video_config.capturing_device_index) {
|
||||
@ -785,14 +789,11 @@ PeerConnectionE2EQualityTest::CreateVideoCapturer(
|
||||
return capturer;
|
||||
}
|
||||
|
||||
if (source != nullptr) {
|
||||
std::unique_ptr<test::TestVideoCapturer> capturer =
|
||||
std::make_unique<VideoSourceBasedVideoCapturer>(std::move(source));
|
||||
capturer->SetFramePreprocessor(std::move(frame_preprocessor));
|
||||
return capturer;
|
||||
std::unique_ptr<test::FrameGeneratorInterface> frame_generator = nullptr;
|
||||
if (generator) {
|
||||
frame_generator = std::move(generator);
|
||||
}
|
||||
|
||||
std::unique_ptr<test::FrameGeneratorInterface> frame_generator = nullptr;
|
||||
if (video_config.generator) {
|
||||
absl::optional<test::FrameGeneratorInterface::OutputType>
|
||||
frame_generator_type = absl::nullopt;
|
||||
|
||||
@ -121,14 +121,14 @@ class PeerConfigurerImpl final
|
||||
PeerConfigurer* AddVideoConfig(
|
||||
PeerConnectionE2EQualityTestFixture::VideoConfig config) override {
|
||||
params_->video_configs.push_back(std::move(config));
|
||||
video_sources_.push_back(nullptr);
|
||||
video_generators_.push_back(nullptr);
|
||||
return this;
|
||||
}
|
||||
PeerConfigurer* AddVideoConfig(
|
||||
PeerConnectionE2EQualityTestFixture::VideoConfig config,
|
||||
std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>> source) override {
|
||||
std::unique_ptr<test::FrameGeneratorInterface> generator) override {
|
||||
params_->video_configs.push_back(std::move(config));
|
||||
video_sources_.push_back(std::move(source));
|
||||
video_generators_.push_back(std::move(generator));
|
||||
return this;
|
||||
}
|
||||
PeerConfigurer* SetAudioConfig(
|
||||
@ -162,16 +162,15 @@ class PeerConfigurerImpl final
|
||||
return std::move(components_);
|
||||
}
|
||||
std::unique_ptr<Params> ReleaseParams() { return std::move(params_); }
|
||||
std::vector<std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>>>
|
||||
ReleaseVideoSources() {
|
||||
return std::move(video_sources_);
|
||||
std::vector<std::unique_ptr<test::FrameGeneratorInterface>>
|
||||
ReleaseVideoGenerators() {
|
||||
return std::move(video_generators_);
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<InjectableComponents> components_;
|
||||
std::unique_ptr<Params> params_;
|
||||
std::vector<std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>>>
|
||||
video_sources_;
|
||||
std::vector<std::unique_ptr<test::FrameGeneratorInterface>> video_generators_;
|
||||
};
|
||||
|
||||
class TestVideoCapturerVideoTrackSource : public VideoTrackSource {
|
||||
@ -262,16 +261,14 @@ class PeerConnectionE2EQualityTest
|
||||
// * Set video source generation mode if it is not specified
|
||||
void SetDefaultValuesForMissingParams(
|
||||
std::vector<Params*> params,
|
||||
std::vector<
|
||||
std::vector<std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>>>*>
|
||||
std::vector<std::vector<std::unique_ptr<test::FrameGeneratorInterface>>*>
|
||||
video_sources);
|
||||
// Validate peer's parameters, also ensure uniqueness of all video stream
|
||||
// labels.
|
||||
void ValidateParams(
|
||||
const RunParams& run_params,
|
||||
std::vector<Params*> params,
|
||||
std::vector<
|
||||
std::vector<std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>>>*>
|
||||
std::vector<std::vector<std::unique_ptr<test::FrameGeneratorInterface>>*>
|
||||
video_sources);
|
||||
// For some functionality some field trials have to be enabled, so we will
|
||||
// enable them here.
|
||||
@ -287,7 +284,7 @@ class PeerConnectionE2EQualityTest
|
||||
MaybeAddVideo(TestPeer* peer);
|
||||
std::unique_ptr<test::TestVideoCapturer> CreateVideoCapturer(
|
||||
const VideoConfig& video_config,
|
||||
std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>> source,
|
||||
std::unique_ptr<test::FrameGeneratorInterface> generator,
|
||||
std::unique_ptr<test::TestVideoCapturer::FramePreprocessor>
|
||||
frame_preprocessor);
|
||||
std::unique_ptr<test::FrameGeneratorInterface>
|
||||
|
||||
@ -328,8 +328,8 @@ absl::optional<RemotePeerAudioConfig> TestPeer::CreateRemoteAudioConfig(
|
||||
std::unique_ptr<TestPeer> TestPeer::CreateTestPeer(
|
||||
std::unique_ptr<InjectableComponents> components,
|
||||
std::unique_ptr<Params> params,
|
||||
std::vector<std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>>>
|
||||
video_sources,
|
||||
std::vector<std::unique_ptr<test::FrameGeneratorInterface>>
|
||||
video_generators,
|
||||
std::unique_ptr<MockPeerConnectionObserver> observer,
|
||||
VideoQualityAnalyzerInjectionHelper* video_analyzer_helper,
|
||||
rtc::Thread* signaling_thread,
|
||||
@ -339,7 +339,7 @@ std::unique_ptr<TestPeer> TestPeer::CreateTestPeer(
|
||||
rtc::TaskQueue* task_queue) {
|
||||
RTC_DCHECK(components);
|
||||
RTC_DCHECK(params);
|
||||
RTC_DCHECK_EQ(params->video_configs.size(), video_sources.size());
|
||||
RTC_DCHECK_EQ(params->video_configs.size(), video_generators.size());
|
||||
SetMandatoryEntities(components.get());
|
||||
params->rtc_configuration.sdp_semantics = SdpSemantics::kUnifiedPlan;
|
||||
|
||||
@ -350,7 +350,7 @@ std::unique_ptr<TestPeer> TestPeer::CreateTestPeer(
|
||||
|
||||
return absl::WrapUnique(new TestPeer(
|
||||
tpc.peer_connection_factory(), tpc.peer_connection(), std::move(observer),
|
||||
std::move(params), std::move(video_sources), tpc.audio_processing()));
|
||||
std::move(params), std::move(video_generators), tpc.audio_processing()));
|
||||
}
|
||||
|
||||
bool TestPeer::AddIceCandidates(
|
||||
@ -376,14 +376,14 @@ TestPeer::TestPeer(
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc,
|
||||
std::unique_ptr<MockPeerConnectionObserver> observer,
|
||||
std::unique_ptr<Params> params,
|
||||
std::vector<std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>>>
|
||||
video_sources,
|
||||
std::vector<std::unique_ptr<test::FrameGeneratorInterface>>
|
||||
video_generators,
|
||||
rtc::scoped_refptr<AudioProcessing> audio_processing)
|
||||
: PeerConnectionWrapper::PeerConnectionWrapper(std::move(pc_factory),
|
||||
std::move(pc),
|
||||
std::move(observer)),
|
||||
params_(std::move(params)),
|
||||
video_sources_(std::move(video_sources)),
|
||||
video_generators_(std::move(video_generators)),
|
||||
audio_processing_(audio_processing) {}
|
||||
|
||||
} // namespace webrtc_pc_e2e
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "api/test/frame_generator_interface.h"
|
||||
#include "api/test/peerconnection_quality_test_fixture.h"
|
||||
#include "media/base/media_engine.h"
|
||||
#include "modules/audio_device/include/test_audio_device.h"
|
||||
@ -62,8 +63,8 @@ class TestPeer final : public PeerConnectionWrapper {
|
||||
static std::unique_ptr<TestPeer> CreateTestPeer(
|
||||
std::unique_ptr<InjectableComponents> components,
|
||||
std::unique_ptr<Params> params,
|
||||
std::vector<std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>>>
|
||||
video_sources,
|
||||
std::vector<std::unique_ptr<test::FrameGeneratorInterface>>
|
||||
video_generators,
|
||||
std::unique_ptr<MockPeerConnectionObserver> observer,
|
||||
VideoQualityAnalyzerInjectionHelper* video_analyzer_helper,
|
||||
rtc::Thread* signaling_thread,
|
||||
@ -73,9 +74,9 @@ class TestPeer final : public PeerConnectionWrapper {
|
||||
rtc::TaskQueue* task_queue);
|
||||
|
||||
Params* params() const { return params_.get(); }
|
||||
std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>> ReleaseVideoSource(
|
||||
std::unique_ptr<test::FrameGeneratorInterface> ReleaseVideoGenerator(
|
||||
size_t i) {
|
||||
return std::move(video_sources_[i]);
|
||||
return std::move(video_generators_[i]);
|
||||
}
|
||||
|
||||
void DetachAecDump() { audio_processing_->DetachAecDump(); }
|
||||
@ -89,13 +90,12 @@ class TestPeer final : public PeerConnectionWrapper {
|
||||
rtc::scoped_refptr<PeerConnectionInterface> pc,
|
||||
std::unique_ptr<MockPeerConnectionObserver> observer,
|
||||
std::unique_ptr<Params> params,
|
||||
std::vector<std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>>>
|
||||
video_sources,
|
||||
std::vector<std::unique_ptr<test::FrameGeneratorInterface>>
|
||||
video_generators,
|
||||
rtc::scoped_refptr<AudioProcessing> audio_processing);
|
||||
|
||||
std::unique_ptr<Params> params_;
|
||||
std::vector<std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>>>
|
||||
video_sources_;
|
||||
std::vector<std::unique_ptr<test::FrameGeneratorInterface>> video_generators_;
|
||||
rtc::scoped_refptr<AudioProcessing> audio_processing_;
|
||||
|
||||
std::vector<std::unique_ptr<IceCandidateInterface>> remote_ice_candidates_;
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019 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.
|
||||
*/
|
||||
|
||||
#include "test/pc/e2e/video_source_based_video_capturer.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace webrtc {
|
||||
namespace webrtc_pc_e2e {
|
||||
|
||||
VideoSourceBasedVideoCapturer::VideoSourceBasedVideoCapturer(
|
||||
std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>> source)
|
||||
: source_(std::move(source)) {
|
||||
source_->AddOrUpdateSink(this, rtc::VideoSinkWants());
|
||||
}
|
||||
VideoSourceBasedVideoCapturer::~VideoSourceBasedVideoCapturer() {
|
||||
source_->RemoveSink(this);
|
||||
}
|
||||
|
||||
void VideoSourceBasedVideoCapturer::OnFrame(const VideoFrame& frame) {
|
||||
TestVideoCapturer::OnFrame(frame);
|
||||
}
|
||||
|
||||
} // namespace webrtc_pc_e2e
|
||||
} // namespace webrtc
|
||||
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019 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 TEST_PC_E2E_VIDEO_SOURCE_BASED_VIDEO_CAPTURER_H_
|
||||
#define TEST_PC_E2E_VIDEO_SOURCE_BASED_VIDEO_CAPTURER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "api/video/video_sink_interface.h"
|
||||
#include "api/video/video_source_interface.h"
|
||||
#include "test/test_video_capturer.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace webrtc_pc_e2e {
|
||||
|
||||
// Used to forward VideoFrame's provided by custom video source into video
|
||||
// quality analyzer and VideoAdapter inside TestVideoCapturer and then properly
|
||||
// broadcast them.
|
||||
class VideoSourceBasedVideoCapturer
|
||||
: public webrtc::test::TestVideoCapturer,
|
||||
public rtc::VideoSinkInterface<VideoFrame> {
|
||||
public:
|
||||
VideoSourceBasedVideoCapturer(
|
||||
std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>> source);
|
||||
~VideoSourceBasedVideoCapturer() override;
|
||||
|
||||
void OnFrame(const VideoFrame& frame) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<rtc::VideoSourceInterface<VideoFrame>> source_;
|
||||
};
|
||||
|
||||
} // namespace webrtc_pc_e2e
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // TEST_PC_E2E_VIDEO_SOURCE_BASED_VIDEO_CAPTURER_H_
|
||||
Loading…
x
Reference in New Issue
Block a user