Prepare for migration of TestPeer and TestPeerFactory on TimeController
Bug: webrtc:11743 Change-Id: I99a9746830a1c6abae753d33cf61890f7a372608 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178605 Reviewed-by: Andrey Logvin <landrey@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31622}
This commit is contained in:
parent
dfc5f0d19d
commit
db1c81d45b
@ -261,6 +261,7 @@ if (!build_with_chromium) {
|
||||
":video_quality_analyzer_injection_helper",
|
||||
"../..:copy_to_file_audio_capturer",
|
||||
"../../../api:peer_connection_quality_test_fixture_api",
|
||||
"../../../api:time_controller",
|
||||
"../../../api/rtc_event_log:rtc_event_log_factory",
|
||||
"../../../api/task_queue:default_task_queue_factory",
|
||||
"../../../api/video_codecs:builtin_video_decoder_factory",
|
||||
|
||||
@ -216,7 +216,10 @@ void PeerConnectionE2EQualityTest::Run(RunParams run_params) {
|
||||
bob_configurer->params()->video_configs;
|
||||
std::string bob_name = bob_configurer->params()->name.value();
|
||||
|
||||
alice_ = TestPeerFactory::CreateTestPeer(
|
||||
TestPeerFactory test_peer_factory(
|
||||
signaling_thread.get(), video_quality_analyzer_injection_helper_.get(),
|
||||
task_queue_.get());
|
||||
alice_ = test_peer_factory.CreateTestPeer(
|
||||
std::move(alice_configurer),
|
||||
std::make_unique<FixturePeerConnectionObserver>(
|
||||
[this, bob_video_configs, alice_name](
|
||||
@ -224,10 +227,9 @@ void PeerConnectionE2EQualityTest::Run(RunParams run_params) {
|
||||
OnTrackCallback(alice_name, transceiver, bob_video_configs);
|
||||
},
|
||||
[this]() { StartVideo(alice_video_sources_); }),
|
||||
video_quality_analyzer_injection_helper_.get(), signaling_thread.get(),
|
||||
alice_remote_audio_config, run_params.video_encoder_bitrate_multiplier,
|
||||
run_params.echo_emulation_config, task_queue_.get());
|
||||
bob_ = TestPeerFactory::CreateTestPeer(
|
||||
run_params.echo_emulation_config);
|
||||
bob_ = test_peer_factory.CreateTestPeer(
|
||||
std::move(bob_configurer),
|
||||
std::make_unique<FixturePeerConnectionObserver>(
|
||||
[this, alice_video_configs,
|
||||
@ -235,9 +237,8 @@ void PeerConnectionE2EQualityTest::Run(RunParams run_params) {
|
||||
OnTrackCallback(bob_name, transceiver, alice_video_configs);
|
||||
},
|
||||
[this]() { StartVideo(bob_video_sources_); }),
|
||||
video_quality_analyzer_injection_helper_.get(), signaling_thread.get(),
|
||||
bob_remote_audio_config, run_params.video_encoder_bitrate_multiplier,
|
||||
run_params.echo_emulation_config, task_queue_.get());
|
||||
run_params.echo_emulation_config);
|
||||
|
||||
int num_cores = CpuInfo::DetectNumberOfCores();
|
||||
RTC_DCHECK_GE(num_cores, 1);
|
||||
|
||||
@ -280,16 +280,20 @@ absl::optional<RemotePeerAudioConfig> RemotePeerAudioConfig::Create(
|
||||
}
|
||||
|
||||
std::unique_ptr<TestPeer> TestPeerFactory::CreateTestPeer(
|
||||
std::unique_ptr<InjectableComponents> components,
|
||||
std::unique_ptr<Params> params,
|
||||
std::vector<PeerConfigurerImpl::VideoSource> video_sources,
|
||||
std::unique_ptr<PeerConfigurerImpl> configurer,
|
||||
std::unique_ptr<MockPeerConnectionObserver> observer,
|
||||
VideoQualityAnalyzerInjectionHelper* video_analyzer_helper,
|
||||
rtc::Thread* signaling_thread,
|
||||
absl::optional<RemotePeerAudioConfig> remote_audio_config,
|
||||
double bitrate_multiplier,
|
||||
absl::optional<EchoEmulationConfig> echo_emulation_config,
|
||||
absl::optional<PeerConnectionE2EQualityTestFixture::EchoEmulationConfig>
|
||||
echo_emulation_config,
|
||||
rtc::TaskQueue* task_queue) {
|
||||
std::unique_ptr<InjectableComponents> components =
|
||||
configurer->ReleaseComponents();
|
||||
std::unique_ptr<Params> params = configurer->ReleaseParams();
|
||||
std::vector<PeerConfigurerImpl::VideoSource> video_sources =
|
||||
configurer->ReleaseVideoSources();
|
||||
RTC_DCHECK(components);
|
||||
RTC_DCHECK(params);
|
||||
RTC_DCHECK_EQ(params->video_configs.size(), video_sources.size());
|
||||
@ -339,18 +343,14 @@ std::unique_ptr<TestPeer> TestPeerFactory::CreateTestPeer(
|
||||
std::unique_ptr<TestPeer> TestPeerFactory::CreateTestPeer(
|
||||
std::unique_ptr<PeerConfigurerImpl> configurer,
|
||||
std::unique_ptr<MockPeerConnectionObserver> observer,
|
||||
VideoQualityAnalyzerInjectionHelper* video_analyzer_helper,
|
||||
rtc::Thread* signaling_thread,
|
||||
absl::optional<RemotePeerAudioConfig> remote_audio_config,
|
||||
double bitrate_multiplier,
|
||||
absl::optional<PeerConnectionE2EQualityTestFixture::EchoEmulationConfig>
|
||||
echo_emulation_config,
|
||||
rtc::TaskQueue* task_queue) {
|
||||
return CreateTestPeer(
|
||||
configurer->ReleaseComponents(), configurer->ReleaseParams(),
|
||||
configurer->ReleaseVideoSources(), std::move(observer),
|
||||
video_analyzer_helper, signaling_thread, remote_audio_config,
|
||||
bitrate_multiplier, echo_emulation_config, task_queue);
|
||||
echo_emulation_config) {
|
||||
return CreateTestPeer(std::move(configurer), std::move(observer),
|
||||
video_analyzer_helper_, signaling_thread_,
|
||||
remote_audio_config, bitrate_multiplier,
|
||||
echo_emulation_config, task_queue_);
|
||||
}
|
||||
|
||||
} // namespace webrtc_pc_e2e
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/rtc_event_log/rtc_event_log_factory.h"
|
||||
#include "api/test/peerconnection_quality_test_fixture.h"
|
||||
#include "api/test/time_controller.h"
|
||||
#include "modules/audio_device/include/test_audio_device.h"
|
||||
#include "rtc_base/task_queue.h"
|
||||
#include "test/pc/e2e/analyzer/video/video_quality_analyzer_injection_helper.h"
|
||||
@ -44,26 +45,31 @@ struct RemotePeerAudioConfig {
|
||||
|
||||
class TestPeerFactory {
|
||||
public:
|
||||
// Setups all components, that should be provided to WebRTC
|
||||
// PeerConnectionFactory and PeerConnection creation methods,
|
||||
// also will setup dependencies, that are required for media analyzers
|
||||
// injection.
|
||||
//
|
||||
// |signaling_thread| will be provided by test fixture implementation.
|
||||
// |params| - describes current peer parameters, like current peer video
|
||||
// streams and audio streams
|
||||
static std::unique_ptr<TestPeer> CreateTestPeer(
|
||||
std::unique_ptr<InjectableComponents> components,
|
||||
std::unique_ptr<Params> params,
|
||||
std::vector<PeerConfigurerImpl::VideoSource> video_sources,
|
||||
std::unique_ptr<MockPeerConnectionObserver> observer,
|
||||
VideoQualityAnalyzerInjectionHelper* video_analyzer_helper,
|
||||
rtc::Thread* signaling_thread,
|
||||
absl::optional<RemotePeerAudioConfig> remote_audio_config,
|
||||
double bitrate_multiplier,
|
||||
absl::optional<PeerConnectionE2EQualityTestFixture::EchoEmulationConfig>
|
||||
echo_emulation_config,
|
||||
rtc::TaskQueue* task_queue);
|
||||
// Creates a test peer factory.
|
||||
// |signaling_thread| will be used as a signaling thread for all peers created
|
||||
// by this factory.
|
||||
// |time_controller| will be used to create required threads, task queue
|
||||
// factories and call factory.
|
||||
// |video_analyzer_helper| will be used to setup video quality analysis for
|
||||
// created peers.
|
||||
// |task_queue| will be used for AEC dump if it is requested.
|
||||
TestPeerFactory(rtc::Thread* signaling_thread,
|
||||
TimeController& time_controller,
|
||||
VideoQualityAnalyzerInjectionHelper* video_analyzer_helper,
|
||||
rtc::TaskQueue* task_queue)
|
||||
: signaling_thread_(signaling_thread),
|
||||
video_analyzer_helper_(video_analyzer_helper),
|
||||
task_queue_(task_queue) {}
|
||||
|
||||
// Same as previous. Created for keeping backward compatibility during
|
||||
// migration. Will be removed soon.
|
||||
TestPeerFactory(rtc::Thread* signaling_thread,
|
||||
VideoQualityAnalyzerInjectionHelper* video_analyzer_helper,
|
||||
rtc::TaskQueue* task_queue)
|
||||
: signaling_thread_(signaling_thread),
|
||||
video_analyzer_helper_(video_analyzer_helper),
|
||||
task_queue_(task_queue) {}
|
||||
|
||||
// Setups all components, that should be provided to WebRTC
|
||||
// PeerConnectionFactory and PeerConnection creation methods,
|
||||
// also will setup dependencies, that are required for media analyzers
|
||||
@ -80,6 +86,19 @@ class TestPeerFactory {
|
||||
absl::optional<PeerConnectionE2EQualityTestFixture::EchoEmulationConfig>
|
||||
echo_emulation_config,
|
||||
rtc::TaskQueue* task_queue);
|
||||
|
||||
std::unique_ptr<TestPeer> CreateTestPeer(
|
||||
std::unique_ptr<PeerConfigurerImpl> configurer,
|
||||
std::unique_ptr<MockPeerConnectionObserver> observer,
|
||||
absl::optional<RemotePeerAudioConfig> remote_audio_config,
|
||||
double bitrate_multiplier,
|
||||
absl::optional<PeerConnectionE2EQualityTestFixture::EchoEmulationConfig>
|
||||
echo_emulation_config);
|
||||
|
||||
private:
|
||||
rtc::Thread* signaling_thread_;
|
||||
VideoQualityAnalyzerInjectionHelper* video_analyzer_helper_;
|
||||
rtc::TaskQueue* task_queue_;
|
||||
};
|
||||
|
||||
} // namespace webrtc_pc_e2e
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user