Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Unified Diff: webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc

Issue 2808513003: Add SafeClamp(), which accepts args of different types (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 d903cf9af7ea633144c7dc16f0442f6c02344d3f..55216a071b0cf4cfb9521c9c8fbf082921a00524 100644
--- a/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc
+++ b/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc
@@ -62,11 +62,11 @@ int64_t AimdRateControl::GetFeedbackInterval() const {
// Estimate how often we can send RTCP if we allocate up to 5% of bandwidth
// to feedback.
static const int kRtcpSize = 80;
- int64_t interval = static_cast<int64_t>(
+ const int64_t interval = static_cast<int64_t>(
kRtcpSize * 8.0 * 1000.0 / (0.05 * current_bitrate_bps_) + 0.5);
const int64_t kMinFeedbackIntervalMs = 200;
- return std::min(std::max(interval, kMinFeedbackIntervalMs),
- kMaxFeedbackIntervalMs);
+ return rtc::SafeClamp(kMinFeedbackIntervalMs, kMaxFeedbackIntervalMs,
+ interval);
}
bool AimdRateControl::TimeToReduceFurther(int64_t time_now,

Powered by Google App Engine
This is Rietveld 408576698