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

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: Handling that minimumThumbLength > trackLen. 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 45d9b2671aa403716ea6ec273613786b7aa2976d..48a3d2952085e983ca0c785d884432eea1f6771a 100644
--- a/third_party/WebKit/Source/platform/audio/AudioResamplerKernel.cpp
+++ b/third_party/WebKit/Source/platform/audio/AudioResamplerKernel.cpp
@@ -28,8 +28,8 @@
#include "platform/audio/AudioResamplerKernel.h"
-#include <algorithm>
#include "platform/audio/AudioResampler.h"
+#include "wtf/MathExtras.h"
namespace blink {
@@ -78,8 +78,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) {

Powered by Google App Engine
This is Rietveld 408576698