Fixes DCHECK bug in LinkCapacityEstimator.

Conversion to kbps will fail if the estimate is lower than the deviation
estimate * 3, since that would produce a negative value.

Bug: webrtc:9718
Change-Id: I83b52acd476d90b1f22c9db9894fa26c9a3e8e17
Reviewed-on: https://webrtc-review.googlesource.com/c/112560
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25854}
This commit is contained in:
Sebastian Jansson
2018-11-30 08:59:00 +01:00
committed by Commit Bot
parent 0c3f4d3709
commit b939d35e8e

View File

@ -25,8 +25,8 @@ DataRate LinkCapacityEstimator::UpperBound() const {
DataRate LinkCapacityEstimator::LowerBound() const {
if (estimate_kbps_.has_value())
return DataRate::kbps(estimate_kbps_.value() -
3 * deviation_estimate_kbps());
return DataRate::kbps(
std::max(0.0, estimate_kbps_.value() - 3 * deviation_estimate_kbps()));
return DataRate::Zero();
}