Make it possible to set the packet size needed to trigger a probe.

The value is today set to 200 which is too low for an audio packet to trigger sending probes.

For the initial probing, it would be good if audio packets, that may arrive before the first video frame can trigger sending a probe.

Also fix field trial parsing of required number of probes.

Bug: webrc:14392
Change-Id: I1f3cebcda38b71446e3602eef9cfa76de61a1ccf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275620
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Diep Bui <diepbp@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38089}
This commit is contained in:
Per Kjellander
2022-09-15 09:31:56 +02:00
committed by WebRTC LUCI CQ
parent 282de03603
commit bd0e8ef946
5 changed files with 42 additions and 12 deletions

View File

@ -110,7 +110,8 @@ ProbeControllerConfig::ProbeControllerConfig(
&min_probe_duration, &network_state_estimate_probing_interval,
&network_state_estimate_fast_rampup_rate,
&network_state_estimate_drop_down_rate, &network_state_probe_scale,
&network_state_probe_duration, &limit_probe_target_rate_to_loss_bwe},
&network_state_probe_duration, &min_probe_packets_sent,
&limit_probe_target_rate_to_loss_bwe},
key_value_config->Lookup("WebRTC-Bwe-ProbingConfiguration"));
// Specialized keys overriding subsets of WebRTC-Bwe-ProbingConfiguration

View File

@ -470,7 +470,7 @@ TEST(ProbeControllerTest, ConfigurableProbingFieldTrial) {
ProbeControllerFixture fixture(
"WebRTC-Bwe-ProbingConfiguration/"
"p1:2,p2:5,step_size:3,further_probe_threshold:0.8,"
"alloc_p1:2,alloc_p2/");
"alloc_p1:2,alloc_p2,min_probe_packets_sent:2/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
@ -479,7 +479,9 @@ TEST(ProbeControllerTest, ConfigurableProbingFieldTrial) {
fixture.CurrentTime());
EXPECT_EQ(probes.size(), 2u);
EXPECT_EQ(probes[0].target_data_rate.bps(), 600);
EXPECT_EQ(probes[0].target_probe_count, 2);
EXPECT_EQ(probes[1].target_data_rate.bps(), 1500);
EXPECT_EQ(probes[1].target_probe_count, 2);
// Repeated probe should only be sent when estimated bitrate climbs above
// 0.8 * 5 * kStartBitrateBps = 1200.

View File

@ -23,11 +23,6 @@
namespace webrtc {
namespace {
// The min probe packet size is scaled with the bitrate we're probing at.
// This defines the max min probe packet size, meaning that on high bitrates
// we have a min probe packet size of 200 bytes.
constexpr DataSize kMinProbePacketSize = DataSize::Bytes(200);
constexpr TimeDelta kProbeClusterTimeout = TimeDelta::Seconds(5);
} // namespace
@ -35,8 +30,9 @@ constexpr TimeDelta kProbeClusterTimeout = TimeDelta::Seconds(5);
BitrateProberConfig::BitrateProberConfig(
const FieldTrialsView* key_value_config)
: min_probe_delta("min_probe_delta", TimeDelta::Millis(2)),
max_probe_delay("max_probe_delay", TimeDelta::Millis(10)) {
ParseFieldTrial({&min_probe_delta, &max_probe_delay},
max_probe_delay("max_probe_delay", TimeDelta::Millis(10)),
min_packet_size("min_packet_size", DataSize::Bytes(200)) {
ParseFieldTrial({&min_probe_delta, &max_probe_delay, &min_packet_size},
key_value_config->Lookup("WebRTC-Bwe-ProbingBehavior"));
}
@ -71,8 +67,11 @@ void BitrateProber::SetEnabled(bool enable) {
void BitrateProber::OnIncomingPacket(DataSize packet_size) {
// Don't initialize probing unless we have something large enough to start
// probing.
// Note that the pacer can send several packets at once when sending a probe,
// and thus, packets can be smaller than needed for a probe.
if (probing_state_ == ProbingState::kInactive && !clusters_.empty() &&
packet_size >= std::min(RecommendedMinProbeSize(), kMinProbePacketSize)) {
packet_size >=
std::min(RecommendedMinProbeSize(), config_.min_packet_size.Get())) {
// Send next probe right away.
next_probe_time_ = Timestamp::MinusInfinity();
probing_state_ = ProbingState::kActive;

View File

@ -33,6 +33,11 @@ struct BitrateProberConfig {
FieldTrialParameter<TimeDelta> min_probe_delta;
// Maximum amount of time each probe can be delayed.
FieldTrialParameter<TimeDelta> max_probe_delay;
// This is used to start sending a probe after a large enough packet.
// The min packet size is scaled with the bitrate we're probing at.
// This defines the max min packet size, meaning that on high bitrates
// a packet of at least this size is needed to trigger sending a probe.
FieldTrialParameter<DataSize> min_packet_size;
};
// Note that this class isn't thread-safe by itself and therefore relies

View File

@ -146,14 +146,37 @@ TEST(BitrateProberTest, DiscardsDelayedProbes) {
TEST(BitrateProberTest, DoesntInitializeProbingForSmallPackets) {
const FieldTrialBasedConfig config;
BitrateProber prober(config);
prober.SetEnabled(true);
EXPECT_FALSE(prober.is_probing());
ASSERT_FALSE(prober.is_probing());
prober.CreateProbeCluster({.at_time = Timestamp::Zero(),
.target_data_rate = DataRate::KilobitsPerSec(1000),
.target_duration = TimeDelta::Millis(15),
.target_probe_count = 5,
.id = 0});
prober.OnIncomingPacket(DataSize::Bytes(100));
EXPECT_FALSE(prober.is_probing());
}
TEST(BitrateProberTest, DoesInitializeProbingForSmallPacketsIfConfigured) {
const test::ExplicitKeyValueConfig config(
"WebRTC-Bwe-ProbingBehavior/"
"min_packet_size:0bytes/");
BitrateProber prober(config);
prober.SetEnabled(true);
ASSERT_FALSE(prober.is_probing());
prober.CreateProbeCluster({.at_time = Timestamp::Zero(),
.target_data_rate = DataRate::KilobitsPerSec(1000),
.target_duration = TimeDelta::Millis(15),
.target_probe_count = 5,
.id = 0});
prober.OnIncomingPacket(DataSize::Bytes(10));
EXPECT_TRUE(prober.is_probing());
}
TEST(BitrateProberTest, VerifyProbeSizeOnHighBitrate) {
const FieldTrialBasedConfig config;
BitrateProber prober(config);