Pass PeerConfigurerImpl directly into CreateTestPeer

Bug: webrtc:11479
Change-Id: Ib514d264bfd94d648d90a053554537880bd9ebe5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174747
Reviewed-by: Andrey Logvin <landrey@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31188}
This commit is contained in:
Artem Titov
2020-05-08 12:14:16 +02:00
committed by Commit Bot
parent 435fb9ad06
commit dcde85c912
4 changed files with 54 additions and 26 deletions

View File

@ -240,6 +240,7 @@ if (rtc_include_tests) {
]
deps = [
":echo_emulation",
":peer_configurer",
":peer_connection_quality_test_params",
":test_peer",
":video_quality_analyzer_injection_helper",

View File

@ -160,23 +160,15 @@ void PeerConnectionE2EQualityTest::Run(RunParams run_params) {
RTC_CHECK_EQ(peer_configurations_.size(), 2)
<< "Only peer to peer calls are allowed, please add 2 peers";
std::unique_ptr<Params> alice_params =
peer_configurations_[0]->ReleaseParams();
std::unique_ptr<InjectableComponents> alice_components =
peer_configurations_[0]->ReleaseComponents();
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<test::FrameGeneratorInterface>>
bob_video_generators = peer_configurations_[1]->ReleaseVideoGenerators();
std::unique_ptr<PeerConfigurerImpl> alice_configurer =
std::move(peer_configurations_[0]);
std::unique_ptr<PeerConfigurerImpl> bob_configurer =
std::move(peer_configurations_[1]);
peer_configurations_.clear();
for (size_t i = 0; i < bob_params->video_configs.size(); ++i) {
for (size_t i = 0; i < bob_configurer->params()->video_configs.size(); ++i) {
// We support simulcast only from caller.
RTC_CHECK(!bob_params->video_configs[i].simulcast_config)
RTC_CHECK(!bob_configurer->params()->video_configs[i].simulcast_config)
<< "Only simulcast stream from first peer is supported";
}
@ -185,11 +177,11 @@ void PeerConnectionE2EQualityTest::Run(RunParams run_params) {
// Print test summary
RTC_LOG(INFO)
<< "Media quality test: Alice will make a call to Bob with media video="
<< !alice_params->video_configs.empty()
<< "; audio=" << alice_params->audio_config.has_value()
<< !alice_configurer->params()->video_configs.empty()
<< "; audio=" << alice_configurer->params()->audio_config.has_value()
<< ". Bob will respond with media video="
<< !bob_params->video_configs.empty()
<< "; audio=" << bob_params->audio_config.has_value();
<< !bob_configurer->params()->video_configs.empty()
<< "; audio=" << bob_configurer->params()->audio_config.has_value();
const std::unique_ptr<rtc::Thread> signaling_thread = rtc::Thread::Create();
signaling_thread->SetName(kSignalThreadName, nullptr);
@ -206,16 +198,17 @@ void PeerConnectionE2EQualityTest::Run(RunParams run_params) {
// catch output of Alice's stream, Alice's output_dump_file_name should be
// passed to Bob's TestPeer setup as audio output file name.
absl::optional<RemotePeerAudioConfig> alice_remote_audio_config =
RemotePeerAudioConfig::Create(bob_params->audio_config);
RemotePeerAudioConfig::Create(bob_configurer->params()->audio_config);
absl::optional<RemotePeerAudioConfig> bob_remote_audio_config =
RemotePeerAudioConfig::Create(alice_params->audio_config);
RemotePeerAudioConfig::Create(alice_configurer->params()->audio_config);
// Copy Alice and Bob video configs to correctly pass them into lambdas.
std::vector<VideoConfig> alice_video_configs = alice_params->video_configs;
std::vector<VideoConfig> bob_video_configs = bob_params->video_configs;
std::vector<VideoConfig> alice_video_configs =
alice_configurer->params()->video_configs;
std::vector<VideoConfig> bob_video_configs =
bob_configurer->params()->video_configs;
alice_ = TestPeerFactory::CreateTestPeer(
std::move(alice_components), std::move(alice_params),
std::move(alice_video_generators),
std::move(alice_configurer),
std::make_unique<FixturePeerConnectionObserver>(
[this, bob_video_configs](
rtc::scoped_refptr<RtpTransceiverInterface> transceiver) {
@ -226,8 +219,7 @@ void PeerConnectionE2EQualityTest::Run(RunParams run_params) {
alice_remote_audio_config, run_params.video_encoder_bitrate_multiplier,
run_params.echo_emulation_config, task_queue_.get());
bob_ = TestPeerFactory::CreateTestPeer(
std::move(bob_components), std::move(bob_params),
std::move(bob_video_generators),
std::move(bob_configurer),
std::make_unique<FixturePeerConnectionObserver>(
[this, alice_video_configs](
rtc::scoped_refptr<RtpTransceiverInterface> transceiver) {

View File

@ -20,6 +20,7 @@
#include "modules/audio_processing/aec_dump/aec_dump_factory.h"
#include "p2p/client/basic_port_allocator.h"
#include "test/pc/e2e/echo/echo_emulation.h"
#include "test/pc/e2e/peer_configurer.h"
#include "test/testsupport/copy_to_file_audio_capturer.h"
namespace webrtc {
@ -326,5 +327,22 @@ std::unique_ptr<TestPeer> TestPeerFactory::CreateTestPeer(
std::move(params), std::move(video_generators), audio_processing));
}
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->ReleaseVideoGenerators(), std::move(observer),
video_analyzer_helper, signaling_thread, remote_audio_config,
bitrate_multiplier, echo_emulation_config, task_queue);
}
} // namespace webrtc_pc_e2e
} // namespace webrtc

View File

@ -21,6 +21,7 @@
#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"
#include "test/pc/e2e/peer_configurer.h"
#include "test/pc/e2e/peer_connection_quality_test_params.h"
#include "test/pc/e2e/test_peer.h"
@ -63,6 +64,22 @@ class TestPeerFactory {
absl::optional<PeerConnectionE2EQualityTestFixture::EchoEmulationConfig>
echo_emulation_config,
rtc::TaskQueue* 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
// injection.
//
// |signaling_thread| will be provided by test fixture implementation.
static std::unique_ptr<TestPeer> 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);
};
} // namespace webrtc_pc_e2e