Chromium Code Reviews| Index: Source/modules/webaudio/AudioContext.cpp |
| diff --git a/Source/modules/webaudio/AudioContext.cpp b/Source/modules/webaudio/AudioContext.cpp |
| index d5a9654632033839f5d9a89b4ae2fd73ce4d6ccd..c2823a0c4e67da24368a2fc75cc867db00ea87ce 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,28 @@ 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) |
| +{ |
| + m_deferredCountModeChange.remove(node); |
|
haraken
2014/09/06 15:29:33
Shall we add ASSERT(isGraphOwner()) ?
Raymond Toy
2014/09/08 18:04:39
Done.
|
| +} |
| + |
| +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) |