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

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

Issue 543073004: Defer changes to the channel count mode to the pre or post-render phase (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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/AudioContext.h ('k') | Source/modules/webaudio/AudioNode.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « Source/modules/webaudio/AudioContext.h ('k') | Source/modules/webaudio/AudioNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698