From 85a9d91cd4cf0429baa4d9cd01af9b7d3d03d410 Mon Sep 17 00:00:00 2001 From: Artem Titov Date: Wed, 29 May 2019 14:36:50 +0200 Subject: [PATCH] Add ability to set min/start/max bitrate on peer's PC in PC quality tests Bug: webrtc:10138, webrtc:10692 Change-Id: I4d7ae84dc2945fef6451a6671786b3b19cd9abd8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/139108 Commit-Queue: Artem Titov Commit-Queue: Mirko Bonadei Reviewed-by: Ilya Nikolaevskiy Reviewed-by: Karl Wiberg Cr-Commit-Position: refs/heads/master@{#28107} --- .../peerconnection_quality_test_fixture.h | 4 +++ test/pc/e2e/peer_connection_quality_test.h | 5 ++++ .../e2e/peer_connection_quality_test_params.h | 1 + test/pc/e2e/test_peer.cc | 1 + video/pc_full_stack_tests.cc | 27 ++++++++++++++----- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/api/test/peerconnection_quality_test_fixture.h b/api/test/peerconnection_quality_test_fixture.h index 3955da5040..34cfc1af9b 100644 --- a/api/test/peerconnection_quality_test_fixture.h +++ b/api/test/peerconnection_quality_test_fixture.h @@ -230,6 +230,10 @@ class PeerConnectionE2EQualityTestFixture { virtual PeerConfigurer* SetAecDumpPath(std::string path) = 0; virtual PeerConfigurer* SetRTCConfiguration( PeerConnectionInterface::RTCConfiguration configuration) = 0; + // Set bitrate parameters on PeerConnection. This constraints will be + // applied to all summed RTP streams for this peer. + virtual PeerConfigurer* SetBitrateParameters( + PeerConnectionInterface::BitrateParameters bitrate_params) = 0; }; // Contains parameters, that describe how long framework should run quality diff --git a/test/pc/e2e/peer_connection_quality_test.h b/test/pc/e2e/peer_connection_quality_test.h index cc00a9a04c..c5e42c1797 100644 --- a/test/pc/e2e/peer_connection_quality_test.h +++ b/test/pc/e2e/peer_connection_quality_test.h @@ -134,6 +134,11 @@ class PeerConfigurerImpl final params_->rtc_configuration = std::move(configuration); return this; } + PeerConfigurer* SetBitrateParameters( + PeerConnectionInterface::BitrateParameters bitrate_params) override { + params_->bitrate_params = bitrate_params; + return this; + } protected: friend class PeerConnectionE2EQualityTest; diff --git a/test/pc/e2e/peer_connection_quality_test_params.h b/test/pc/e2e/peer_connection_quality_test_params.h index 76dd406a18..fa9988c116 100644 --- a/test/pc/e2e/peer_connection_quality_test_params.h +++ b/test/pc/e2e/peer_connection_quality_test_params.h @@ -109,6 +109,7 @@ struct Params { absl::optional aec_dump_path; PeerConnectionInterface::RTCConfiguration rtc_configuration; + PeerConnectionInterface::BitrateParameters bitrate_params; }; } // namespace webrtc_pc_e2e diff --git a/test/pc/e2e/test_peer.cc b/test/pc/e2e/test_peer.cc index 33c1036a8c..5123e34db4 100644 --- a/test/pc/e2e/test_peer.cc +++ b/test/pc/e2e/test_peer.cc @@ -101,6 +101,7 @@ struct TestPeerComponents { CreatePCDependencies(std::move(components->pc_dependencies), observer); peer_connection = peer_connection_factory->CreatePeerConnection( params.rtc_configuration, std::move(pc_deps)); + peer_connection->SetBitrate(params.bitrate_params); } std::unique_ptr CreateAudioCapturer( diff --git a/video/pc_full_stack_tests.cc b/video/pc_full_stack_tests.cc index 22491bc380..fade2bd62c 100644 --- a/video/pc_full_stack_tests.cc +++ b/video/pc_full_stack_tests.cc @@ -273,11 +273,10 @@ TEST_P(PCGenericDescriptorTest, ForemanCifWithoutPacketLoss) { fixture->Run(std::move(run_params)); } -TEST_P(PCGenericDescriptorTest, ForemanCif35kbpsWithoutPacketLoss) { +TEST_P(PCGenericDescriptorTest, ForemanCif30kbpsWithoutPacketLoss) { std::unique_ptr network_emulation_manager = CreateNetworkEmulationManager(); BuiltInNetworkBehaviorConfig config; - config.link_capacity_kbps = 35; auto fixture = CreateTestFixture( GetTestName("pc_foreman_cif_30kbps_net_delay_0_0_plr_0"), CreateTwoNetworkLinks(network_emulation_manager.get(), config), @@ -286,6 +285,12 @@ TEST_P(PCGenericDescriptorTest, ForemanCif35kbpsWithoutPacketLoss) { video.input_file_name = ClipNameToClipPath("foreman_cif"); video.stream_label = "alice-video"; alice->AddVideoConfig(std::move(video)); + + PeerConnectionInterface::BitrateParameters bitrate_params; + bitrate_params.min_bitrate_bps = 30000; + bitrate_params.current_bitrate_bps = 30000; + bitrate_params.max_bitrate_bps = 30000; + alice->SetBitrateParameters(bitrate_params); }, [](PeerConfigurer* bob) {}); RunParams run_params(TimeDelta::seconds(kTestDurationSec)); @@ -297,13 +302,12 @@ TEST_P(PCGenericDescriptorTest, ForemanCif35kbpsWithoutPacketLoss) { // TODO(webrtc:9722): Remove when experiment is cleaned up. TEST_P(PCGenericDescriptorTest, - ForemanCif35kbpsWithoutPacketLossTrustedRateControl) { + ForemanCif30kbpsWithoutPacketLossTrustedRateControl) { test::ScopedFieldTrials override_field_trials( AppendFieldTrials(kVp8TrustedRateControllerFieldTrial)); std::unique_ptr network_emulation_manager = CreateNetworkEmulationManager(); BuiltInNetworkBehaviorConfig config; - config.link_capacity_kbps = 35; auto fixture = CreateTestFixture( GetTestName( "pc_foreman_cif_30kbps_net_delay_0_0_plr_0_trusted_rate_ctrl"), @@ -313,6 +317,12 @@ TEST_P(PCGenericDescriptorTest, video.input_file_name = ClipNameToClipPath("foreman_cif"); video.stream_label = "alice-video"; alice->AddVideoConfig(std::move(video)); + + PeerConnectionInterface::BitrateParameters bitrate_params; + bitrate_params.min_bitrate_bps = 30000; + bitrate_params.current_bitrate_bps = 30000; + bitrate_params.max_bitrate_bps = 30000; + alice->SetBitrateParameters(bitrate_params); }, [](PeerConfigurer* bob) {}); RunParams run_params(TimeDelta::seconds(kTestDurationSec)); @@ -540,11 +550,10 @@ TEST(PCFullStackTest, ForemanCifWithoutPacketlossH264) { fixture->Run(std::move(run_params)); } -TEST(PCFullStackTest, ForemanCif35kbpsWithoutPacketlossH264) { +TEST(PCFullStackTest, ForemanCif30kbpsWithoutPacketlossH264) { std::unique_ptr network_emulation_manager = CreateNetworkEmulationManager(); BuiltInNetworkBehaviorConfig config; - config.link_capacity_kbps = 35; auto fixture = CreateTestFixture( "pc_foreman_cif_30kbps_net_delay_0_0_plr_0_H264", CreateTwoNetworkLinks(network_emulation_manager.get(), config), @@ -553,6 +562,12 @@ TEST(PCFullStackTest, ForemanCif35kbpsWithoutPacketlossH264) { video.input_file_name = ClipNameToClipPath("foreman_cif"); video.stream_label = "alice-video"; alice->AddVideoConfig(std::move(video)); + + PeerConnectionInterface::BitrateParameters bitrate_params; + bitrate_params.min_bitrate_bps = 30000; + bitrate_params.current_bitrate_bps = 30000; + bitrate_params.max_bitrate_bps = 30000; + alice->SetBitrateParameters(bitrate_params); }, [](PeerConfigurer* bob) {}); RunParams run_params(TimeDelta::seconds(kTestDurationSec));