diff --git a/api/test/peerconnection_quality_test_fixture.h b/api/test/peerconnection_quality_test_fixture.h index c352aa9da5..198868d7a7 100644 --- a/api/test/peerconnection_quality_test_fixture.h +++ b/api/test/peerconnection_quality_test_fixture.h @@ -446,21 +446,6 @@ class PeerConnectionE2EQualityTestFixture { // If set to true peers will be able to use Flex FEC, otherwise they won't // be able to negotiate it even if it's enabled on per peer level. bool enable_flex_fec_support = false; - // TODO(titovartem): delete this field. - // Deprecated. Use `PeerConfigurer::SetUseUlpFEC`. - bool use_ulp_fec = false; - // TODO(titovartem): delete this field. - // Deprecated. Use `PeerConfigurer::SetUseFlexFEC`. - bool use_flex_fec = false; - // TODO(titovartem): delete this field. - // Deprecated. Use `PeerConfigurer::SetVideoEncoderBitrateMultiplier`. - // Specifies how much video encoder target bitrate should be different than - // target bitrate, provided by WebRTC stack. Must be greater then 0. Can be - // used to emulate overshooting of video encoders. This multiplier will - // be applied for all video encoder on both sides for all layers. Bitrate - // estimated by WebRTC stack will be multiplied on this multiplier and then - // provided into VideoEncoder::SetRates(...). - double video_encoder_bitrate_multiplier = 1.0; // If true will set conference mode in SDP media section for all video // tracks for all peers. bool use_conference_mode = false; diff --git a/test/pc/e2e/peer_configurer.cc b/test/pc/e2e/peer_configurer.cc index 00d6f79745..a903c86322 100644 --- a/test/pc/e2e/peer_configurer.cc +++ b/test/pc/e2e/peer_configurer.cc @@ -178,141 +178,5 @@ void PeerParamsPreprocessor::ValidateParams(const PeerConfigurerImpl& peer) { } } -void SetDefaultValuesForMissingParams( - RunParams* run_params, - std::vector>* peers) { - DefaultNamesProvider peer_names_provider("peer_", kDefaultNames); - for (size_t i = 0; i < peers->size(); ++i) { - auto* peer = peers->at(i).get(); - auto* p = peer->params(); - peer_names_provider.MaybeSetName(p->name); - DefaultNamesProvider video_stream_names_provider( - *p->name + "_auto_video_stream_label_"); - for (VideoConfig& video_config : p->video_configs) { - video_stream_names_provider.MaybeSetName(video_config.stream_label); - } - if (p->audio_config) { - DefaultNamesProvider audio_stream_names_provider( - *p->name + "_auto_audio_stream_label_"); - audio_stream_names_provider.MaybeSetName(p->audio_config->stream_label); - } - - if (p->video_codecs.empty()) { - p->video_codecs.push_back( - PeerConnectionE2EQualityTestFixture::VideoCodecConfig( - cricket::kVp8CodecName)); - } - } -} - -void ValidateParams( - const RunParams& run_params, - const std::vector>& peers) { - RTC_CHECK_GT(run_params.video_encoder_bitrate_multiplier, 0.0); - - std::set peer_names; - std::set video_labels; - std::set audio_labels; - std::set video_sync_groups; - std::set audio_sync_groups; - int media_streams_count = 0; - - for (size_t i = 0; i < peers.size(); ++i) { - Params* p = peers[i]->params(); - // Each peer should at least support 1 video codec. - RTC_CHECK_GE(p->video_codecs.size(), 1); - - { - RTC_CHECK(p->name); - bool inserted = peer_names.insert(p->name.value()).second; - RTC_CHECK(inserted) << "Duplicate name=" << p->name.value(); - } - - if (p->audio_config) { - media_streams_count++; - } - media_streams_count += p->video_configs.size(); - - // Validate that all video stream labels are unique and sync groups are - // valid. - for (const VideoConfig& video_config : p->video_configs) { - RTC_CHECK(video_config.stream_label); - bool inserted = - video_labels.insert(video_config.stream_label.value()).second; - RTC_CHECK(inserted) << "Duplicate video_config.stream_label=" - << video_config.stream_label.value(); - - if (video_config.input_dump_file_name.has_value()) { - RTC_CHECK_GT(video_config.input_dump_sampling_modulo, 0) - << "video_config.input_dump_sampling_modulo must be greater than 0"; - } - if (video_config.output_dump_file_name.has_value()) { - RTC_CHECK_GT(video_config.output_dump_sampling_modulo, 0) - << "video_config.input_dump_sampling_modulo must be greater than 0"; - } - - // TODO(bugs.webrtc.org/4762): remove this check after synchronization of - // more than two streams is supported. - if (video_config.sync_group.has_value()) { - bool sync_group_inserted = - video_sync_groups.insert(video_config.sync_group.value()).second; - RTC_CHECK(sync_group_inserted) - << "Sync group shouldn't consist of more than two streams (one " - "video and one audio). Duplicate video_config.sync_group=" - << video_config.sync_group.value(); - } - - if (video_config.simulcast_config) { - if (video_config.simulcast_config->target_spatial_index) { - RTC_CHECK_GE(*video_config.simulcast_config->target_spatial_index, 0); - RTC_CHECK_LT(*video_config.simulcast_config->target_spatial_index, - video_config.simulcast_config->simulcast_streams_count); - } - RTC_CHECK(!video_config.max_encode_bitrate_bps) - << "Setting max encode bitrate is not implemented for simulcast."; - RTC_CHECK(!video_config.min_encode_bitrate_bps) - << "Setting min encode bitrate is not implemented for simulcast."; - if (p->video_codecs[0].name == cricket::kVp8CodecName && - !video_config.simulcast_config->encoding_params.empty()) { - RTC_CHECK_EQ(video_config.simulcast_config->simulcast_streams_count, - video_config.simulcast_config->encoding_params.size()) - << "|encoding_params| have to be specified for each simulcast " - << "stream in |simulcast_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(); - // TODO(bugs.webrtc.org/4762): remove this check after synchronization of - // more than two streams is supported. - if (p->audio_config->sync_group.has_value()) { - bool sync_group_inserted = - audio_sync_groups.insert(p->audio_config->sync_group.value()) - .second; - RTC_CHECK(sync_group_inserted) - << "Sync group shouldn't consist of more than two streams (one " - "video and one audio). Duplicate audio_config.sync_group=" - << p->audio_config->sync_group.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); - } - if (p->audio_config.value().mode == AudioConfig::Mode::kFile) { - RTC_CHECK(p->audio_config.value().input_file_name); - RTC_CHECK( - test::FileExists(p->audio_config.value().input_file_name.value())) - << p->audio_config.value().input_file_name.value() - << " doesn't exist"; - } - } - } - - RTC_CHECK_GT(media_streams_count, 0) << "No media in the call."; -} - } // namespace webrtc_pc_e2e } // namespace webrtc diff --git a/test/pc/e2e/peer_configurer.h b/test/pc/e2e/peer_configurer.h index 89a26f5160..faf887834d 100644 --- a/test/pc/e2e/peer_configurer.h +++ b/test/pc/e2e/peer_configurer.h @@ -280,24 +280,6 @@ class PeerParamsPreprocessor { int media_streams_count = 0; }; -// TODO(titovartem): delete this method. -// Deprecated. Use `PeerParamsPreprocessor`. -// Set missing params to default values if it is required: -// * Generate video stream labels if some of them are missing -// * Generate audio stream labels if some of them are missing -// * Set video source generation mode if it is not specified -// * Video codecs under test -void SetDefaultValuesForMissingParams( - PeerConnectionE2EQualityTestFixture::RunParams* run_params, - std::vector>* peers); -// TODO(titovartem): delete this method. -// Deprecated. Use `PeerParamsPreprocessor`. -// Validate peer's parameters, also ensure uniqueness of all video stream -// labels. -void ValidateParams( - const PeerConnectionE2EQualityTestFixture::RunParams& run_params, - const std::vector>& peers); - } // namespace webrtc_pc_e2e } // namespace webrtc diff --git a/test/pc/e2e/peer_connection_quality_test.cc b/test/pc/e2e/peer_connection_quality_test.cc index 34d5e80d3c..8729eeacc2 100644 --- a/test/pc/e2e/peer_connection_quality_test.cc +++ b/test/pc/e2e/peer_connection_quality_test.cc @@ -181,8 +181,11 @@ PeerConnectionE2EQualityTest::PeerHandle* PeerConnectionE2EQualityTest::AddPeer( } void PeerConnectionE2EQualityTest::Run(RunParams run_params) { - SetDefaultValuesForMissingParams(&run_params, &peer_configurations_); - ValidateParams(run_params, peer_configurations_); + webrtc::webrtc_pc_e2e::PeerParamsPreprocessor params_preprocessor; + for (auto& peer_configuration : peer_configurations_) { + params_preprocessor.SetDefaultValuesForMissingParams(*peer_configuration); + params_preprocessor.ValidateParams(*peer_configuration); + } ValidateP2PSimulcastParams(peer_configurations_); RTC_CHECK_EQ(peer_configurations_.size(), 2) << "Only peer to peer calls are allowed, please add 2 peers"; diff --git a/test/pc/e2e/test_peer_factory.cc b/test/pc/e2e/test_peer_factory.cc index 6349ee7acc..709148c5b3 100644 --- a/test/pc/e2e/test_peer_factory.cc +++ b/test/pc/e2e/test_peer_factory.cc @@ -302,20 +302,6 @@ std::unique_ptr TestPeerFactory::CreateTestPeer( absl::optional remote_audio_config, absl::optional echo_emulation_config) { - double bitrate_multiplier = - configurer->params()->video_encoder_bitrate_multiplier; - return CreateTestPeer(std::move(configurer), std::move(observer), - remote_audio_config, bitrate_multiplier, - echo_emulation_config); -} - -std::unique_ptr TestPeerFactory::CreateTestPeer( - std::unique_ptr configurer, - std::unique_ptr observer, - absl::optional remote_audio_config, - double bitrate_multiplier, - absl::optional - echo_emulation_config) { std::unique_ptr components = configurer->ReleaseComponents(); std::unique_ptr params = configurer->ReleaseParams(); @@ -339,7 +325,7 @@ std::unique_ptr TestPeerFactory::CreateTestPeer( params->audio_config, remote_audio_config, echo_emulation_config, components->pcf_dependencies->task_queue_factory.get()); WrapVideoEncoderFactory( - params->name.value(), bitrate_multiplier, + params->name.value(), params->video_encoder_bitrate_multiplier, CalculateRequiredSpatialIndexPerStream(params->video_configs), components->pcf_dependencies.get(), video_analyzer_helper_); WrapVideoDecoderFactory(params->name.value(), diff --git a/test/pc/e2e/test_peer_factory.h b/test/pc/e2e/test_peer_factory.h index 4010167e91..8d78e2f8d9 100644 --- a/test/pc/e2e/test_peer_factory.h +++ b/test/pc/e2e/test_peer_factory.h @@ -72,14 +72,6 @@ class TestPeerFactory { absl::optional remote_audio_config, absl::optional echo_emulation_config); - // Deprecated. Use the one above. - std::unique_ptr CreateTestPeer( - std::unique_ptr configurer, - std::unique_ptr observer, - absl::optional remote_audio_config, - double bitrate_multiplier, - absl::optional - echo_emulation_config); private: rtc::Thread* signaling_thread_; diff --git a/video/pc_full_stack_tests.cc b/video/pc_full_stack_tests.cc index d052e2813d..1f56674562 100644 --- a/video/pc_full_stack_tests.cc +++ b/video/pc_full_stack_tests.cc @@ -558,10 +558,7 @@ TEST(PCFullStackTest, Pc_Foreman_Cif_Net_Delay_0_0_Plr_0_H264) { [](PeerConfigurer* bob) { bob->SetVideoCodecs({VideoCodecConfig(cricket::kH264CodecName)}); }); - RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); - run_params.use_flex_fec = false; - run_params.use_ulp_fec = false; - fixture->Run(std::move(run_params)); + fixture->Run(RunParams(TimeDelta::Seconds(kTestDurationSec))); } TEST(PCFullStackTest, Pc_Foreman_Cif_30kbps_Net_Delay_0_0_Plr_0_H264) { @@ -589,10 +586,7 @@ TEST(PCFullStackTest, Pc_Foreman_Cif_30kbps_Net_Delay_0_0_Plr_0_H264) { [](PeerConfigurer* bob) { bob->SetVideoCodecs({VideoCodecConfig(cricket::kH264CodecName)}); }); - RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); - run_params.use_flex_fec = false; - run_params.use_ulp_fec = false; - fixture->Run(std::move(run_params)); + fixture->Run(RunParams(TimeDelta::Seconds(kTestDurationSec))); } TEST(PCGenericDescriptorTest, @@ -617,10 +611,7 @@ TEST(PCGenericDescriptorTest, [](PeerConfigurer* bob) { bob->SetVideoCodecs({VideoCodecConfig(cricket::kH264CodecName)}); }); - RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); - run_params.use_flex_fec = false; - run_params.use_ulp_fec = false; - fixture->Run(std::move(run_params)); + fixture->Run(RunParams(TimeDelta::Seconds(kTestDurationSec))); } TEST(PCFullStackTest, Pc_Foreman_Cif_Delay_50_0_Plr_5_H264_Sps_Pps_Idr) { @@ -647,10 +638,7 @@ TEST(PCFullStackTest, Pc_Foreman_Cif_Delay_50_0_Plr_5_H264_Sps_Pps_Idr) { [](PeerConfigurer* bob) { bob->SetVideoCodecs({VideoCodecConfig(cricket::kH264CodecName)}); }); - RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); - run_params.use_flex_fec = false; - run_params.use_ulp_fec = false; - fixture->Run(std::move(run_params)); + fixture->Run(RunParams(TimeDelta::Seconds(kTestDurationSec))); } TEST(PCFullStackTest, Pc_Foreman_Cif_Delay_50_0_Plr_5_H264_Flexfec) { @@ -670,13 +658,14 @@ TEST(PCFullStackTest, Pc_Foreman_Cif_Delay_50_0_Plr_5_H264_Flexfec) { video, ClipNameToClipPath("foreman_cif")); alice->AddVideoConfig(std::move(video), std::move(frame_generator)); alice->SetVideoCodecs({VideoCodecConfig(cricket::kH264CodecName)}); + alice->SetUseFlexFEC(true); }, [](PeerConfigurer* bob) { bob->SetVideoCodecs({VideoCodecConfig(cricket::kH264CodecName)}); + bob->SetUseFlexFEC(true); }); RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); - run_params.use_flex_fec = true; - run_params.use_ulp_fec = false; + run_params.enable_flex_fec_support = true; fixture->Run(std::move(run_params)); } @@ -699,14 +688,13 @@ TEST(PCFullStackTest, DISABLED_Pc_Foreman_Cif_Delay_50_0_Plr_5_H264_Ulpfec) { video, ClipNameToClipPath("foreman_cif")); alice->AddVideoConfig(std::move(video), std::move(frame_generator)); alice->SetVideoCodecs({VideoCodecConfig(cricket::kH264CodecName)}); + alice->SetUseUlpFEC(true); }, [](PeerConfigurer* bob) { bob->SetVideoCodecs({VideoCodecConfig(cricket::kH264CodecName)}); + bob->SetUseUlpFEC(true); }); - RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); - run_params.use_flex_fec = false; - run_params.use_ulp_fec = true; - fixture->Run(std::move(run_params)); + fixture->Run(RunParams(TimeDelta::Seconds(kTestDurationSec))); } #endif // defined(WEBRTC_USE_H264)