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

Unified Diff: webrtc/modules/audio_processing/aec3/echo_remover_metrics.cc

Issue 2808513003: Add SafeClamp(), which accepts args of different types (Closed)
Patch Set: rebase Created 3 years, 6 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/audio_processing/aec3/echo_remover_metrics.cc
diff --git a/webrtc/modules/audio_processing/aec3/echo_remover_metrics.cc b/webrtc/modules/audio_processing/aec3/echo_remover_metrics.cc
index ed1195996fe59c49ce8f910702a0c3731b229c90..bc7e600cfa2c1629d1748d3abe0ea01ee1dd503e 100644
--- a/webrtc/modules/audio_processing/aec3/echo_remover_metrics.cc
+++ b/webrtc/modules/audio_processing/aec3/echo_remover_metrics.cc
@@ -14,6 +14,7 @@
#include <algorithm>
#include <numeric>
+#include "webrtc/base/safe_minmax.h"
#include "webrtc/system_wrappers/include/metrics.h"
namespace webrtc {
@@ -273,7 +274,7 @@ int TransformDbMetricForReporting(bool negate,
if (negate) {
new_value = -new_value;
}
- return static_cast<int>(std::max(min_value, std::min(max_value, new_value)));
+ return static_cast<int>(rtc::SafeClamp(new_value, min_value, max_value));
}
} // namespace aec3

Powered by Google App Engine
This is Rietveld 408576698