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

Unified Diff: third_party/WebKit/Source/platform/audio/AudioResamplerKernel.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/AudioResamplerKernel.cpp
diff --git a/third_party/WebKit/Source/platform/audio/AudioResamplerKernel.cpp b/third_party/WebKit/Source/platform/audio/AudioResamplerKernel.cpp
index b75ea4a78ef1e39afebe8942abfeff4a711a88cf..8d2345184586f9e9db291fba4728b17121720199 100644
--- a/third_party/WebKit/Source/platform/audio/AudioResamplerKernel.cpp
+++ b/third_party/WebKit/Source/platform/audio/AudioResamplerKernel.cpp
@@ -25,8 +25,8 @@
#include "platform/audio/AudioResamplerKernel.h"
#if ENABLE(WEB_AUDIO)
-#include <algorithm>
#include "platform/audio/AudioResampler.h"
+#include "wtf/MathExtras.h"
namespace blink {
@@ -75,8 +75,7 @@ void AudioResamplerKernel::process(float* destination, size_t framesToProcess)
float* source = m_sourceBuffer.data();
double rate = this->rate();
- rate = std::max(0.0, rate);
- rate = std::min(AudioResampler::MaxRate, rate);
+ rate = clampTo(rate, 0.0, AudioResampler::MaxRate);
// Start out with the previous saved values (if any).
if (m_fillIndex > 0) {
« no previous file with comments | « third_party/WebKit/Source/platform/audio/AudioDelayDSPKernel.cpp ('k') | third_party/WebKit/Source/platform/audio/Biquad.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698