Avoid max bitrate probing when exponential probing in progress
Avoid starting the max probing when there is an exponential probing session in progress. BUG=webrtc:6332 R=philipel@webrtc.org, stefan@webrtc.org Review URL: https://codereview.webrtc.org/2269873002 . Cr-Commit-Position: refs/heads/master@{#14268}
This commit is contained in:
parent
b55c434c65
commit
9b7b75324f
@ -54,11 +54,13 @@ void ProbeController::SetBitrates(int min_bitrate_bps,
|
||||
}
|
||||
|
||||
// Only do probing if:
|
||||
// - we are mid-call, which we consider to be if
|
||||
// |estimated_bitrate_bps_| != 0, and
|
||||
// - the current bitrate is lower than the new |max_bitrate_bps|, and
|
||||
// - we actually want to increase the |max_bitrate_bps_|.
|
||||
if (estimated_bitrate_bps_ != 0 && estimated_bitrate_bps_ < max_bitrate_bps &&
|
||||
// we are mid-call, which we consider to be if
|
||||
// exponential probing is not active and
|
||||
// |estimated_bitrate_bps_| is valid (> 0) and
|
||||
// the current bitrate is lower than the new |max_bitrate_bps|, and
|
||||
// we actually want to increase the |max_bitrate_bps_|.
|
||||
if (state_ != State::kWaitingForProbingResult &&
|
||||
estimated_bitrate_bps_ != 0 && estimated_bitrate_bps_ < max_bitrate_bps &&
|
||||
max_bitrate_bps > max_bitrate_bps_) {
|
||||
InitiateProbing({max_bitrate_bps}, kExponentialProbingDisabled);
|
||||
}
|
||||
|
||||
@ -29,6 +29,8 @@ constexpr int kMinBitrateBps = 100;
|
||||
constexpr int kStartBitrateBps = 300;
|
||||
constexpr int kMaxBitrateBps = 1000;
|
||||
|
||||
constexpr int kExponentialProbingTimeoutMs = 5000;
|
||||
|
||||
} // namespace
|
||||
|
||||
class ProbeControllerTest : public ::testing::Test {
|
||||
@ -53,9 +55,10 @@ TEST_F(ProbeControllerTest, InitiatesProbingOnMaxBitrateIncrease) {
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(AtLeast(2));
|
||||
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
|
||||
kMaxBitrateBps);
|
||||
clock_.AdvanceTimeMilliseconds(25);
|
||||
|
||||
// Long enough to time out exponential probing.
|
||||
clock_.AdvanceTimeMilliseconds(kExponentialProbingTimeoutMs);
|
||||
probe_controller_->SetEstimatedBitrate(kStartBitrateBps);
|
||||
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(kMaxBitrateBps + 100, _));
|
||||
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
|
||||
kMaxBitrateBps + 100);
|
||||
@ -73,7 +76,7 @@ TEST_F(ProbeControllerTest, TestExponentialProbingTimeout) {
|
||||
kMaxBitrateBps);
|
||||
|
||||
// Advance far enough to cause a time out in waiting for probing result.
|
||||
clock_.AdvanceTimeMilliseconds(5000);
|
||||
clock_.AdvanceTimeMilliseconds(kExponentialProbingTimeoutMs);
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(2 * 1800, _)).Times(0);
|
||||
probe_controller_->SetEstimatedBitrate(1800);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user