Index: Source/modules/webaudio/MediaElementAudioSourceNode.cpp |
diff --git a/Source/modules/webaudio/MediaElementAudioSourceNode.cpp b/Source/modules/webaudio/MediaElementAudioSourceNode.cpp |
index e0812428868b5512fb97840db09ff06ab8a6941e..6d1204232ef01854e36e41ad743c4d2b65ab41d0 100644 |
--- a/Source/modules/webaudio/MediaElementAudioSourceNode.cpp |
+++ b/Source/modules/webaudio/MediaElementAudioSourceNode.cpp |
@@ -32,13 +32,10 @@ |
#include "modules/webaudio/AudioContext.h" |
#include "modules/webaudio/AudioNodeOutput.h" |
#include "platform/Logging.h" |
+#include "platform/audio/AudioUtilities.h" |
#include "platform/graphics/media/MediaPlayer.h" |
#include "wtf/Locker.h" |
-// These are somewhat arbitrary limits, but we need to do some kind of sanity-checking. |
-const unsigned minSampleRate = 8000; |
-const unsigned maxSampleRate = 192000; |
- |
namespace blink { |
MediaElementAudioSourceNode* MediaElementAudioSourceNode::create(AudioContext* context, HTMLMediaElement* mediaElement) |
@@ -76,7 +73,7 @@ void MediaElementAudioSourceNode::dispose() |
void MediaElementAudioSourceNode::setFormat(size_t numberOfChannels, float sourceSampleRate) |
{ |
if (numberOfChannels != m_sourceNumberOfChannels || sourceSampleRate != m_sourceSampleRate) { |
- if (!numberOfChannels || numberOfChannels > AudioContext::maxNumberOfChannels() || sourceSampleRate < minSampleRate || sourceSampleRate > maxSampleRate) { |
+ if (!numberOfChannels || numberOfChannels > AudioContext::maxNumberOfChannels() || !AudioUtilities::isValidAudioBufferSampleRate(sourceSampleRate)) { |
// process() will generate silence for these uninitialized values. |
WTF_LOG(Media, "MediaElementAudioSourceNode::setFormat(%u, %f) - unhandled format change", static_cast<unsigned>(numberOfChannels), sourceSampleRate); |
m_sourceNumberOfChannels = 0; |