Index: Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp |
=================================================================== |
--- Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp (revision 143515) |
+++ Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp (working copy) |
@@ -101,6 +101,14 @@ |
return; |
} |
+ // After calling setBuffer() with a buffer having a different number of channels, there can in rare cases be a slight delay |
+ // before the output bus is updated to the new number of channels because of use of tryLocks() in the context's updating system. |
+ // In this case, if the the buffer has just been changed and we're not quite ready yet, then just output silence. |
+ if (numberOfChannels() != buffer()->numberOfChannels()) { |
+ outputBus->zero(); |
+ return; |
+ } |
+ |
size_t quantumFrameOffset; |
size_t bufferFramesToProcess; |
@@ -155,7 +163,7 @@ |
bool AudioBufferSourceNode::renderFromBuffer(AudioBus* bus, unsigned destinationFrameOffset, size_t numberOfFrames) |
{ |
ASSERT(context()->isAudioThread()); |
- |
+ |
// Basic sanity checking |
ASSERT(bus); |
ASSERT(buffer()); |