Index: third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp |
diff --git a/third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp b/third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp |
index 392f5d64fff9d52d965decf113cd12c5a65616f0..6cd7edcfd009b3a714b2e994d4f79b31dc4c7452 100644 |
--- a/third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp |
+++ b/third_party/WebKit/Source/modules/webaudio/ConvolverNode.cpp |
@@ -111,11 +111,16 @@ void ConvolverHandler::setBuffer(AudioBuffer* buffer, ExceptionState& exceptionS |
unsigned numberOfChannels = buffer->numberOfChannels(); |
size_t bufferLength = buffer->length(); |
- // The current implementation supports up to four channel impulse responses, which are interpreted as true-stereo (see Reverb class). |
- bool isBufferGood = numberOfChannels > 0 && numberOfChannels <= 4 && bufferLength; |
- ASSERT(isBufferGood); |
- if (!isBufferGood) |
+ // The current implementation supports only 1-, 2-, or 4-channel impulse responses, with the |
+ // 4-channel response being interpreted as true-stereo (see Reverb class). |
+ bool isChannelCountGood = numberOfChannels == 1 || numberOfChannels == 2 || numberOfChannels == 4; |
+ |
+ if (!isChannelCountGood) { |
+ exceptionState.throwDOMException( |
+ NotSupportedError, |
+ "The buffer must have 1, 2, or 4 channels, not " + String::number(numberOfChannels)); |
return; |
+ } |
// Wrap the AudioBuffer by an AudioBus. It's an efficient pointer set and not a memcpy(). |
// This memory is simply used in the Reverb constructor and no reference to it is kept for later use in that class. |