Don't trigger too many probes when max allocated bitrate changes.

This fixes an issue which can happen if fec is used. The protection
rate may fluctuate and each such change would trigger a new allocation
limit to be signaled. For each such update, the probe controller could
initiate a new probe.

We work around this by both quantizing the protection fraction and by
not sending a new probe unless the max allocated bitrate has increased
significantly (or we are in ALR).

Bug: webrtc:10070
Change-Id: I328963da23aedbcbedeb877aec46f5955cd2b88d
Reviewed-on: https://webrtc-review.googlesource.com/c/113525
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25971}
This commit is contained in:
Erik Språng
2018-12-11 15:29:29 +01:00
committed by Commit Bot
parent 01092957f5
commit 00672b1ddc
2 changed files with 6 additions and 4 deletions

View File

@ -228,9 +228,11 @@ void BitrateAllocator::UpdateAllocationLimits() {
}
total_requested_padding_bitrate += stream_padding;
uint32_t max_bitrate_bps = config.max_bitrate_bps;
if (config.media_ratio > 0) {
max_bitrate_bps =
static_cast<uint32_t>(max_bitrate_bps / config.media_ratio);
if (config.media_ratio < 1.0) {
// Account for protection overhead (eg FEC). Assumption is that overhead
// is never more than 100%. Don't adjust based exact value as that might
// trigger too frequent calls to OnAllocationLimitsChanged().
max_bitrate_bps *= 2;
}
total_requested_max_bitrate += max_bitrate_bps;
if (config.allocated_bitrate_bps > 0 && config.has_packet_feedback)

View File

@ -357,7 +357,7 @@ TEST_F(BitrateAllocatorTestNoEnforceMin, OneBitrateObserverWithPacketLoss) {
const double kProtectionRatio = 0.4;
uint32_t target_bitrate_bps = 200000;
const uint32_t kMaxBitrateWithProtectionBps =
static_cast<uint32_t>(kMaxBitrateBps / (1 - kProtectionRatio));
static_cast<uint32_t>(kMaxBitrateBps * 2);
uint8_t fraction_loss = kProtectionRatio * 256;
bitrate_observer.SetBitrateProtectionRatio(kProtectionRatio);
EXPECT_CALL(limit_observer_,