Initiate mid-call probing even if estimated bitrate is at max configured bitrate.

BUG=none

Review-Url: https://codereview.webrtc.org/2634883003
Cr-Commit-Position: refs/heads/master@{#16107}
This commit is contained in:
philipel 2017-01-17 02:08:28 -08:00 committed by Commit bot
parent fa5a368b3c
commit da5e9d04f5
2 changed files with 22 additions and 4 deletions

View File

@ -72,6 +72,8 @@ void ProbeController::SetBitrates(int64_t min_bitrate_bps,
start_bitrate_bps_ = min_bitrate_bps;
}
// The reason we use the variable |old_max_bitrate_pbs| is because we
// need to set |max_bitrate_bps_| before we call InitiateProbing.
int64_t old_max_bitrate_bps = max_bitrate_bps_;
max_bitrate_bps_ = max_bitrate_bps;
@ -85,10 +87,11 @@ void ProbeController::SetBitrates(int64_t min_bitrate_bps,
break;
case State::kProbingComplete:
// Initiate probing when |max_bitrate_| was increased mid-call.
if (estimated_bitrate_bps_ != kExponentialProbingDisabled &&
estimated_bitrate_bps_ < old_max_bitrate_bps &&
max_bitrate_bps_ > old_max_bitrate_bps) {
// If the new max bitrate is higher than the old max bitrate and the
// estimate is lower than the new max bitrate then initiate probing.
if (estimated_bitrate_bps_ != 0 &&
old_max_bitrate_bps < max_bitrate_bps_ &&
estimated_bitrate_bps_ < max_bitrate_bps_) {
// The assumption is that if we jump more than 20% in the bandwidth
// estimate or if the bandwidth estimate is within 90% of the new
// max bitrate then the probing attempt was successful.

View File

@ -79,6 +79,21 @@ TEST_F(ProbeControllerTest, InitiatesProbingOnMaxBitrateIncrease) {
kMaxBitrateBps + 100);
}
TEST_F(ProbeControllerTest, InitiatesProbingOnMaxBitrateIncreaseAtMaxBitrate) {
EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(AtLeast(2));
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
kMaxBitrateBps);
// Long enough to time out exponential probing.
clock_.AdvanceTimeMilliseconds(kExponentialProbingTimeoutMs);
probe_controller_->SetEstimatedBitrate(kStartBitrateBps);
probe_controller_->Process();
probe_controller_->SetEstimatedBitrate(kMaxBitrateBps);
EXPECT_CALL(pacer_, CreateProbeCluster(kMaxBitrateBps + 100));
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
kMaxBitrateBps + 100);
}
TEST_F(ProbeControllerTest, TestExponentialProbing) {
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
kMaxBitrateBps);