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

Unified Diff: webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.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/remote_bitrate_estimator/test/bwe_test_framework.cc
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc
index 15e759b65466a425515f7243eeaf2414775a4020..1361277508f3a06be07c195891a0d1b05b739b09 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc
@@ -15,6 +15,7 @@
#include <sstream>
#include "webrtc/base/constructormagic.h"
+#include "webrtc/base/safe_minmax.h"
namespace webrtc {
namespace testing {
@@ -406,8 +407,8 @@ namespace {
inline int64_t TruncatedNSigmaGaussian(Random* const random,
int64_t mean,
int64_t std_dev) {
- int64_t gaussian_random = random->Gaussian(mean, std_dev);
- return std::max(std::min(gaussian_random, kN * std_dev), -kN * std_dev);
+ const int64_t gaussian_random = random->Gaussian(mean, std_dev);
+ return rtc::SafeClamp(gaussian_random, -kN * std_dev, kN * std_dev);
}
}
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698