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

Side by Side Diff: Source/modules/webaudio/AudioContext.h

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: Add ASSERT 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 void registerLiveNode(AudioNode&); 144 void registerLiveNode(AudioNode&);
145 145
146 // AudioContext can pull node(s) at the end of each render quantum even when they are not connected to any downstream nodes. 146 // AudioContext can pull node(s) at the end of each render quantum even when they are not connected to any downstream nodes.
147 // These two methods are called by the nodes who want to add/remove themselv es into/from the automatic pull lists. 147 // These two methods are called by the nodes who want to add/remove themselv es into/from the automatic pull lists.
148 void addAutomaticPullNode(AudioNode*); 148 void addAutomaticPullNode(AudioNode*);
149 void removeAutomaticPullNode(AudioNode*); 149 void removeAutomaticPullNode(AudioNode*);
150 150
151 // Called right before handlePostRenderTasks() to handle nodes which need to be pulled even when they are not connected to anything. 151 // Called right before handlePostRenderTasks() to handle nodes which need to be pulled even when they are not connected to anything.
152 void processAutomaticPullNodes(size_t framesToProcess); 152 void processAutomaticPullNodes(size_t framesToProcess);
153 153
154 // Keep track of AudioNode's that have their channel count mode changed. We process the changes
155 // in the post rendering phase.
156 void addChangedChannelCountMode(AudioNode*);
157 void removeChangedChannelCountMode(AudioNode*);
158 void updateChangedChannelCountMode();
159
154 // Keeps track of the number of connections made. 160 // Keeps track of the number of connections made.
155 void incrementConnectionCount() 161 void incrementConnectionCount()
156 { 162 {
157 ASSERT(isMainThread()); 163 ASSERT(isMainThread());
158 m_connectionCount++; 164 m_connectionCount++;
159 } 165 }
160 166
161 unsigned connectionCount() const { return m_connectionCount; } 167 unsigned connectionCount() const { return m_connectionCount; }
162 168
163 // 169 //
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 // we cannot use HeapVectors. 341 // we cannot use HeapVectors.
336 GC_PLUGIN_IGNORE("http://crbug.com/404527") 342 GC_PLUGIN_IGNORE("http://crbug.com/404527")
337 Vector<AudioNode*> m_deferredBreakConnectionList; 343 Vector<AudioNode*> m_deferredBreakConnectionList;
338 344
339 Member<AudioBuffer> m_renderTarget; 345 Member<AudioBuffer> m_renderTarget;
340 346
341 bool m_isOfflineContext; 347 bool m_isOfflineContext;
342 348
343 AsyncAudioDecoder m_audioDecoder; 349 AsyncAudioDecoder m_audioDecoder;
344 350
351 // Collection of nodes where the channel count mode has changed. We want the channel count mode
352 // to change in the pre- or post-rendering phase so as not to disturb the ru nning audio thread.
353 GC_PLUGIN_IGNORE("http://crbug.com/404527")
354 HashSet<AudioNode*> m_deferredCountModeChange;
355
345 // This is considering 32 is large enough for multiple channels audio. 356 // This is considering 32 is large enough for multiple channels audio.
346 // It is somewhat arbitrary and could be increased if necessary. 357 // It is somewhat arbitrary and could be increased if necessary.
347 enum { MaxNumberOfChannels = 32 }; 358 enum { MaxNumberOfChannels = 32 };
348 }; 359 };
349 360
350 } // namespace blink 361 } // namespace blink
351 362
352 #endif // AudioContext_h 363 #endif // AudioContext_h
OLDNEW
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698