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

Unified Diff: third_party/WebKit/Source/platform/audio/EqualPowerPanner.cpp

Issue 1530723004: Use clampTo instead of chaining std::max(std::min(...)) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More rebase Created 5 years 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: third_party/WebKit/Source/platform/audio/EqualPowerPanner.cpp
diff --git a/third_party/WebKit/Source/platform/audio/EqualPowerPanner.cpp b/third_party/WebKit/Source/platform/audio/EqualPowerPanner.cpp
index 9d55691c7e01dfe34c953b02d8dbc41ae6e14319..fafe8328e1e48cbccdf6ceee752c7cd5a62540dc 100644
--- a/third_party/WebKit/Source/platform/audio/EqualPowerPanner.cpp
+++ b/third_party/WebKit/Source/platform/audio/EqualPowerPanner.cpp
@@ -25,10 +25,11 @@
#include "platform/audio/EqualPowerPanner.h"
#if ENABLE(WEB_AUDIO)
-#include <algorithm>
#include "platform/audio/AudioBus.h"
#include "platform/audio/AudioUtilities.h"
#include "wtf/MathExtras.h"
+#include <algorithm>
+#include <cmath>
// Use a 50ms smoothing / de-zippering time-constant.
const float SmoothingTimeConstant = 0.050f;
@@ -67,8 +68,7 @@ void EqualPowerPanner::pan(double azimuth, double /*elevation*/, const AudioBus*
return;
// Clamp azimuth to allowed range of -180 -> +180.
- azimuth = std::max(-180.0, azimuth);
- azimuth = std::min(180.0, azimuth);
+ azimuth = clampTo(azimuth, -180.0, 180.0);
// Alias the azimuth ranges behind us to in front of us:
// -90 -> -180 to -90 -> 0 and 90 -> 180 to 90 -> 0

Powered by Google App Engine
This is Rietveld 408576698