Index: webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc |
diff --git a/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc b/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc |
index 5b0ba5a22b27be88a8e7d803f5092b95ddcad3c5..19834daed274ef6278362f45ff9727d8c90eb1c0 100644 |
--- a/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc |
+++ b/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc |
@@ -15,6 +15,7 @@ |
#include <cmath> |
#include "webrtc/base/checks.h" |
+#include "webrtc/base/safe_minmax.h" |
#include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h" |
#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" |
@@ -237,8 +238,8 @@ uint32_t AimdRateControl::MultiplicativeRateIncrease( |
int64_t now_ms, int64_t last_ms, uint32_t current_bitrate_bps) const { |
double alpha = 1.08; |
if (last_ms > -1) { |
- int time_since_last_update_ms = std::min(static_cast<int>(now_ms - last_ms), |
- 1000); |
+ auto time_since_last_update_ms = |
+ rtc::SafeMin<double>(now_ms - last_ms, 1000); |
alpha = pow(alpha, time_since_last_update_ms / 1000.0); |
} |
uint32_t multiplicative_increase_bps = std::max( |