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}
diff --git a/modules/congestion_controller/goog_cc/link_capacity_estimator.cc b/modules/congestion_controller/goog_cc/link_capacity_estimator.cc
index d16f074..8f59c9a 100644
--- a/modules/congestion_controller/goog_cc/link_capacity_estimator.cc
+++ b/modules/congestion_controller/goog_cc/link_capacity_estimator.cc
@@ -25,8 +25,8 @@
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();
}