Index: Source/modules/webaudio/AudioContext.cpp |
diff --git a/Source/modules/webaudio/AudioContext.cpp b/Source/modules/webaudio/AudioContext.cpp |
index d5a9654632033839f5d9a89b4ae2fd73ce4d6ccd..be5509479ced0f59f0e33e85adc72865bd3c62a1 100644 |
--- a/Source/modules/webaudio/AudioContext.cpp |
+++ b/Source/modules/webaudio/AudioContext.cpp |
@@ -677,6 +677,9 @@ void AudioContext::handlePreRenderTasks() |
// It's OK if the tryLock() fails, we'll just take slightly longer to pick up the changes. |
bool mustReleaseLock; |
if (tryLock(mustReleaseLock)) { |
+ // Update the channel count mode. |
+ updateChangedChannelCountMode(); |
+ |
// Fixup the state of any dirty AudioSummingJunctions and AudioNodeOutputs. |
handleDirtyAudioSummingJunctions(); |
handleDirtyAudioNodeOutputs(); |
@@ -697,6 +700,9 @@ void AudioContext::handlePostRenderTasks() |
// from the render graph (in which case they'll render silence). |
bool mustReleaseLock; |
if (tryLock(mustReleaseLock)) { |
+ // Update the channel count mode. |
+ updateChangedChannelCountMode(); |
+ |
// Take care of AudioNode tasks where the tryLock() failed previously. |
handleDeferredAudioNodeTasks(); |
@@ -894,6 +900,30 @@ void AudioContext::trace(Visitor* visitor) |
EventTargetWithInlineData::trace(visitor); |
} |
+void AudioContext::addChangedChannelCountMode(AudioNode* node) |
+{ |
+ ASSERT(isGraphOwner()); |
+ ASSERT(isMainThread()); |
+ m_deferredCountModeChange.add(node); |
+} |
+ |
+void AudioContext::removeChangedChannelCountMode(AudioNode* node) |
+{ |
+ ASSERT(isGraphOwner()); |
+ |
+ m_deferredCountModeChange.remove(node); |
+} |
+ |
+void AudioContext::updateChangedChannelCountMode() |
+{ |
+ ASSERT(isGraphOwner()); |
+ |
+ for (HashSet<AudioNode*>::iterator k = m_deferredCountModeChange.begin(); k != m_deferredCountModeChange.end(); ++k) |
+ (*k)->updateChannelCountMode(); |
+ |
+ m_deferredCountModeChange.clear(); |
+} |
+ |
} // namespace blink |
#endif // ENABLE(WEB_AUDIO) |