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

Unified Diff: Source/platform/audio/AudioUtilities.cpp

Issue 565643003: Move utility functions for sample rate to AudioUtilities. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add modification in MediaElementSourceNode. Created 6 years, 3 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
« no previous file with comments | « Source/platform/audio/AudioUtilities.h ('k') | Source/platform/audio/HRTFPanner.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/audio/AudioUtilities.cpp
diff --git a/Source/platform/audio/AudioUtilities.cpp b/Source/platform/audio/AudioUtilities.cpp
index 531d22d3ed8e4788da6ca2a771fa987434cdb4b2..e498321a07930c968988f8a2bc5c6572c7f4b762 100644
--- a/Source/platform/audio/AudioUtilities.cpp
+++ b/Source/platform/audio/AudioUtilities.cpp
@@ -27,6 +27,7 @@
#if ENABLE(WEB_AUDIO)
#include "platform/audio/AudioUtilities.h"
+
#include "wtf/Assertions.h"
#include "wtf/MathExtras.h"
@@ -59,6 +60,23 @@ size_t timeToSampleFrame(double time, double sampleRate)
{
return static_cast<size_t>(round(time * sampleRate));
}
+
+bool isValidAudioBufferSampleRate(float sampleRate)
+{
+ return sampleRate >= minAudioBufferSampleRate() && sampleRate <= maxAudioBufferSampleRate();
+}
+
+float minAudioBufferSampleRate()
+{
+ // crbug.com/344375
+ return 3000;
+}
+
+float maxAudioBufferSampleRate()
+{
+ // Windows can support audio sampling rates this high, so allow AudioBuffer rates this high as well.
+ return 192000;
+}
} // AudioUtilites
} // namespace blink
« no previous file with comments | « Source/platform/audio/AudioUtilities.h ('k') | Source/platform/audio/HRTFPanner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698