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

Unified Diff: Source/modules/webaudio/ConvolverNode.cpp

Issue 200543005: ConvolverNode.buffer sample rate must match AudioContext rate (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update expected results. Created 6 years, 9 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/modules/webaudio/ConvolverNode.h ('k') | Source/modules/webaudio/ConvolverNode.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webaudio/ConvolverNode.cpp
diff --git a/Source/modules/webaudio/ConvolverNode.cpp b/Source/modules/webaudio/ConvolverNode.cpp
index 0073ae8a6586f54e2073fd256429cc1f8042468e..8f36f915a5145009cad0f4df081b877202b6c642 100644
--- a/Source/modules/webaudio/ConvolverNode.cpp
+++ b/Source/modules/webaudio/ConvolverNode.cpp
@@ -28,6 +28,8 @@
#include "modules/webaudio/ConvolverNode.h"
+#include "bindings/v8/ExceptionState.h"
+#include "core/dom/ExceptionCode.h"
#include "platform/audio/Reverb.h"
#include "modules/webaudio/AudioBuffer.h"
#include "modules/webaudio/AudioContext.h"
@@ -107,13 +109,21 @@ void ConvolverNode::uninitialize()
AudioNode::uninitialize();
}
-void ConvolverNode::setBuffer(AudioBuffer* buffer)
+void ConvolverNode::setBuffer(AudioBuffer* buffer, ExceptionState& exceptionState)
{
ASSERT(isMainThread());
if (!buffer)
return;
+ if (buffer->sampleRate() != context()->sampleRate()) {
+ exceptionState.throwDOMException(
+ NotSupportedError,
+ "The buffer sample rate of " + String::number(buffer->sampleRate())
+ + " does not match the context rate of " + String::number(context()->sampleRate())
+ + " Hz.");
+ }
tkent 2015/04/08 04:52:35 Should we do |return| here?
Raymond Toy 2015/04/08 15:49:44 Yes! I'll fix this right away.
+
unsigned numberOfChannels = buffer->numberOfChannels();
size_t bufferLength = buffer->length();
« no previous file with comments | « Source/modules/webaudio/ConvolverNode.h ('k') | Source/modules/webaudio/ConvolverNode.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698