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 <titovartem@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28107}
diff --git a/api/test/peerconnection_quality_test_fixture.h b/api/test/peerconnection_quality_test_fixture.h
index 3955da5..34cfc1a 100644
--- a/api/test/peerconnection_quality_test_fixture.h
+++ b/api/test/peerconnection_quality_test_fixture.h
@@ -230,6 +230,10 @@
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 cc00a9a..c5e42c1 100644
--- a/test/pc/e2e/peer_connection_quality_test.h
+++ b/test/pc/e2e/peer_connection_quality_test.h
@@ -134,6 +134,11 @@
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 76dd406..fa9988c 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 @@
absl::optional<std::string> 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 33c1036..5123e34 100644
--- a/test/pc/e2e/test_peer.cc
+++ b/test/pc/e2e/test_peer.cc
@@ -101,6 +101,7 @@
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<TestAudioDeviceModule::Capturer> CreateAudioCapturer(
diff --git a/video/pc_full_stack_tests.cc b/video/pc_full_stack_tests.cc
index 22491bc..fade2bd 100644
--- a/video/pc_full_stack_tests.cc
+++ b/video/pc_full_stack_tests.cc
@@ -273,11 +273,10 @@
fixture->Run(std::move(run_params));
}
-TEST_P(PCGenericDescriptorTest, ForemanCif35kbpsWithoutPacketLoss) {
+TEST_P(PCGenericDescriptorTest, ForemanCif30kbpsWithoutPacketLoss) {
std::unique_ptr<NetworkEmulationManager> 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 @@
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 @@
// TODO(webrtc:9722): Remove when experiment is cleaned up.
TEST_P(PCGenericDescriptorTest,
- ForemanCif35kbpsWithoutPacketLossTrustedRateControl) {
+ ForemanCif30kbpsWithoutPacketLossTrustedRateControl) {
test::ScopedFieldTrials override_field_trials(
AppendFieldTrials(kVp8TrustedRateControllerFieldTrial));
std::unique_ptr<NetworkEmulationManager> 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 @@
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 @@
fixture->Run(std::move(run_params));
}
-TEST(PCFullStackTest, ForemanCif35kbpsWithoutPacketlossH264) {
+TEST(PCFullStackTest, ForemanCif30kbpsWithoutPacketlossH264) {
std::unique_ptr<NetworkEmulationManager> 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 @@
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));