Fix probing breakage with send-side BWE introduced by r11322.
BUG=chromium:580046, webrtc:4173 Review URL: https://codereview.webrtc.org/1615873002 Cr-Commit-Position: refs/heads/master@{#11344}
This commit is contained in:
@ -181,14 +181,19 @@ void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms,
|
||||
}
|
||||
|
||||
void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) {
|
||||
// We trust the REMB during the first 2 seconds if we haven't had any
|
||||
// packet loss reported, to allow startup bitrate probing.
|
||||
if (last_fraction_loss_ == 0 && IsInStartPhase(now_ms) &&
|
||||
bwe_incoming_ > bitrate_) {
|
||||
bitrate_ = CapBitrateToThresholds(now_ms, bwe_incoming_);
|
||||
min_bitrate_history_.clear();
|
||||
min_bitrate_history_.push_back(std::make_pair(now_ms, bitrate_));
|
||||
return;
|
||||
// We trust the REMB and/or delay-based estimate during the first 2 seconds if
|
||||
// we haven't had any packet loss reported, to allow startup bitrate probing.
|
||||
if (last_fraction_loss_ == 0 && IsInStartPhase(now_ms)) {
|
||||
uint32_t prev_bitrate = bitrate_;
|
||||
if (bwe_incoming_ > bitrate_)
|
||||
bitrate_ = CapBitrateToThresholds(now_ms, bwe_incoming_);
|
||||
if (delay_based_bitrate_bps_ > bitrate_)
|
||||
bitrate_ = CapBitrateToThresholds(now_ms, delay_based_bitrate_bps_);
|
||||
if (bitrate_ != prev_bitrate) {
|
||||
min_bitrate_history_.clear();
|
||||
min_bitrate_history_.push_back(std::make_pair(now_ms, bitrate_));
|
||||
return;
|
||||
}
|
||||
}
|
||||
UpdateMinHistory(now_ms);
|
||||
// Only start updating bitrate when receiving receiver blocks.
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
TEST(SendSideBweTest, InitialRembWithProbing) {
|
||||
void TestProbing(bool use_delay_based) {
|
||||
SendSideBandwidthEstimation bwe;
|
||||
bwe.SetMinMaxBitrate(100000, 1500000);
|
||||
bwe.SetSendBitrate(200000);
|
||||
@ -28,7 +28,11 @@ TEST(SendSideBweTest, InitialRembWithProbing) {
|
||||
bwe.UpdateReceiverBlock(0, 50, 1, now_ms);
|
||||
|
||||
// Initial REMB applies immediately.
|
||||
bwe.UpdateReceiverEstimate(now_ms, kRembBps);
|
||||
if (use_delay_based) {
|
||||
bwe.UpdateDelayBasedEstimate(now_ms, kRembBps);
|
||||
} else {
|
||||
bwe.UpdateReceiverEstimate(now_ms, kRembBps);
|
||||
}
|
||||
bwe.UpdateEstimate(now_ms);
|
||||
int bitrate;
|
||||
uint8_t fraction_loss;
|
||||
@ -38,13 +42,25 @@ TEST(SendSideBweTest, InitialRembWithProbing) {
|
||||
|
||||
// Second REMB doesn't apply immediately.
|
||||
now_ms += 2001;
|
||||
bwe.UpdateReceiverEstimate(now_ms, kSecondRembBps);
|
||||
if (use_delay_based) {
|
||||
bwe.UpdateDelayBasedEstimate(now_ms, kSecondRembBps);
|
||||
} else {
|
||||
bwe.UpdateReceiverEstimate(now_ms, kSecondRembBps);
|
||||
}
|
||||
bwe.UpdateEstimate(now_ms);
|
||||
bitrate = 0;
|
||||
bwe.CurrentEstimate(&bitrate, &fraction_loss, &rtt);
|
||||
EXPECT_EQ(kRembBps, bitrate);
|
||||
}
|
||||
|
||||
TEST(SendSideBweTest, InitialRembWithProbing) {
|
||||
TestProbing(false);
|
||||
}
|
||||
|
||||
TEST(SendSideBweTest, InitialDelayBasedBweWithProbing) {
|
||||
TestProbing(true);
|
||||
}
|
||||
|
||||
TEST(SendSideBweTest, DoesntReapplyBitrateDecreaseWithoutFollowingRemb) {
|
||||
SendSideBandwidthEstimation bwe;
|
||||
static const int kMinBitrateBps = 100000;
|
||||
|
||||
Reference in New Issue
Block a user