diff --git a/test/pc/e2e/api/peerconnection_quality_test_fixture.h b/test/pc/e2e/api/peerconnection_quality_test_fixture.h index cfb982f79c..2191ceeede 100644 --- a/test/pc/e2e/api/peerconnection_quality_test_fixture.h +++ b/test/pc/e2e/api/peerconnection_quality_test_fixture.h @@ -116,6 +116,7 @@ class PeerConnectionE2EQualityTestFixture { size_t height; int32_t fps; // Have to be unique among all specified configs for all peers in the call. + // Will be auto generated if omitted. absl::optional stream_label; // Only single from 3 next fields can be specified. // If specified generator with this name will be used as input. @@ -131,7 +132,7 @@ class PeerConnectionE2EQualityTestFixture { // video stream has not spatial layers and simulcast streams. // 2. |target_spatial_index| presented and simulcast encoder is used: // in such case |target_spatial_index| will specify the index of - // simulcast strem, that should be analyzed. Other streams will be + // simulcast stream, that should be analyzed. Other streams will be // dropped. // 3. |target_spatial_index| presented and SVP encoder is used: // in such case |target_spatial_index| will specify the top interesting @@ -156,6 +157,9 @@ class PeerConnectionE2EQualityTestFixture { kGenerated, kFile, }; + // Have to be unique among all specified configs for all peers in the call. + // Will be auto generated if omitted. + absl::optional stream_label; Mode mode; // Have to be specified only if mode = kFile absl::optional input_file_name; diff --git a/test/pc/e2e/peer_connection_e2e_smoke_test.cc b/test/pc/e2e/peer_connection_e2e_smoke_test.cc index e246851138..616c8638d5 100644 --- a/test/pc/e2e/peer_connection_e2e_smoke_test.cc +++ b/test/pc/e2e/peer_connection_e2e_smoke_test.cc @@ -69,11 +69,9 @@ TEST(PeerConnectionE2EQualityTestSmokeTest, RunWithEmulatedNetwork) { alice_video_config.generator = VideoGeneratorType::kDefault; alice_params->video_configs.push_back(alice_video_config); - alice_params->audio_config = AudioConfig{ - AudioConfig::Mode::kGenerated, - /*input_file_name=*/absl::nullopt, - /*input_dump_file_name=*/absl::nullopt, - /*output_dump_file_name=*/absl::nullopt, cricket::AudioOptions()}; + alice_params->audio_config = AudioConfig(); + alice_params->audio_config->mode = AudioConfig::Mode::kGenerated, + alice_params->audio_config->audio_options = cricket::AudioOptions(); auto bob_params = absl::make_unique(); VideoConfig bob_video_config; @@ -84,11 +82,9 @@ TEST(PeerConnectionE2EQualityTestSmokeTest, RunWithEmulatedNetwork) { bob_video_config.generator = VideoGeneratorType::kDefault; bob_params->video_configs.push_back(bob_video_config); - bob_params->audio_config = AudioConfig{ - AudioConfig::Mode::kGenerated, - /*input_file_name=*/absl::nullopt, - /*input_dump_file_name=*/absl::nullopt, - /*output_dump_file_name=*/absl::nullopt, cricket::AudioOptions()}; + bob_params->audio_config = AudioConfig(); + bob_params->audio_config->mode = AudioConfig::Mode::kGenerated, + bob_params->audio_config->audio_options = cricket::AudioOptions(); // Setup emulated network NetworkEmulationManager network_emulation_manager; diff --git a/test/pc/e2e/peer_connection_quality_test.cc b/test/pc/e2e/peer_connection_quality_test.cc index 26fffd9c1d..5382ac66a8 100644 --- a/test/pc/e2e/peer_connection_quality_test.cc +++ b/test/pc/e2e/peer_connection_quality_test.cc @@ -266,24 +266,37 @@ void PeerConnectionE2EQualityTest::Run( void PeerConnectionE2EQualityTest::SetMissedVideoStreamLabels( std::vector params) { - int counter = 0; + int video_counter = 0; + int audio_counter = 0; std::set video_labels; + std::set audio_labels; for (auto* p : params) { for (auto& video_config : p->video_configs) { if (!video_config.stream_label) { std::string label; do { - label = "_auto_video_stream_label_" + std::to_string(counter); - ++counter; + label = "_auto_video_stream_label_" + std::to_string(video_counter); + ++video_counter; } while (!video_labels.insert(label).second); video_config.stream_label = label; } } + if (p->audio_config) { + if (!p->audio_config->stream_label) { + std::string label; + do { + label = "_auto_audio_stream_label_" + std::to_string(audio_counter); + ++audio_counter; + } while (!audio_labels.insert(label).second); + p->audio_config->stream_label = label; + } + } } } void PeerConnectionE2EQualityTest::ValidateParams(std::vector params) { std::set video_labels; + std::set audio_labels; int media_streams_count = 0; for (Params* p : params) { @@ -313,6 +326,10 @@ void PeerConnectionE2EQualityTest::ValidateParams(std::vector params) { << VideoConfigSourcePresenceToString(video_config); } if (p->audio_config) { + bool inserted = + audio_labels.insert(p->audio_config->stream_label.value()).second; + RTC_CHECK(inserted) << "Duplicate audio_config.stream_label=" + << p->audio_config->stream_label.value(); // Check that if mode input file name specified only if mode is kFile. if (p->audio_config.value().mode == AudioConfig::Mode::kGenerated) { RTC_CHECK(!p->audio_config.value().input_file_name); @@ -466,12 +483,12 @@ void PeerConnectionE2EQualityTest::MaybeAddAudio(TestPeer* peer) { if (!peer->params()->audio_config) { return; } + const AudioConfig& audio_config = peer->params()->audio_config.value(); rtc::scoped_refptr source = - peer->pc_factory()->CreateAudioSource( - peer->params()->audio_config->audio_options); + peer->pc_factory()->CreateAudioSource(audio_config.audio_options); rtc::scoped_refptr track = - peer->pc_factory()->CreateAudioTrack("audio", source); - peer->AddTrack(track, {"audio"}); + peer->pc_factory()->CreateAudioTrack(*audio_config.stream_label, source); + peer->AddTrack(track, {*audio_config.stream_label}); } void PeerConnectionE2EQualityTest::SetupCall() {