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 |