Fix integer overflow in ProbeController.
Previously ProbeController would overflow int when calculating min_bitrate_to_probe_further_bps and when probing bitrate is above 17 Mbps. The problem was introduced in https://codereview.webrtc.org/2504023002. Fixed ProbeController to use int64_t internally for bitrate calculations. BUG=6332 Review-Url: https://codereview.webrtc.org/2574533002 Cr-Commit-Position: refs/heads/master@{#15642}
This commit is contained in:
@ -83,8 +83,8 @@ TEST_F(ProbeControllerTest, TestExponentialProbing) {
|
||||
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
|
||||
kMaxBitrateBps);
|
||||
|
||||
// Repeated probe should only be sent when estimated bitrate climbs above 4 *
|
||||
// kStartBitrateBps = 1200.
|
||||
// Repeated probe should only be sent when estimated bitrate climbs above
|
||||
// 0.7 * 6 * kStartBitrateBps = 1260.
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(0);
|
||||
probe_controller_->SetEstimatedBitrate(1000);
|
||||
testing::Mock::VerifyAndClearExpectations(&pacer_);
|
||||
@ -160,5 +160,20 @@ TEST_F(ProbeControllerTest, PeriodicProbing) {
|
||||
testing::Mock::VerifyAndClearExpectations(&pacer_);
|
||||
}
|
||||
|
||||
TEST_F(ProbeControllerTest, TestExponentialProbingOverflow) {
|
||||
const int64_t kMbpsMultiplier = 1000000;
|
||||
probe_controller_->SetBitrates(kMinBitrateBps, 10 * kMbpsMultiplier,
|
||||
100 * kMbpsMultiplier);
|
||||
|
||||
// Verify that probe bitrate is capped at the specified max bitrate
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(100 * kMbpsMultiplier, _));
|
||||
probe_controller_->SetEstimatedBitrate(60 * kMbpsMultiplier);
|
||||
testing::Mock::VerifyAndClearExpectations(&pacer_);
|
||||
|
||||
// Verify that repeated probes aren't sent.
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(0);
|
||||
probe_controller_->SetEstimatedBitrate(100 * kMbpsMultiplier);
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user