Changeset 106423 in webkit
- Timestamp:
- Jan 31, 2012 7:23:12 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r106422 r106423 1 2012-01-31 Raymond Liu <raymond.liu@intel.com> 2 3 Dynamic allocate AudioBus with required number of channels for AudioNodeInput 4 https://bugs.webkit.org/show_bug.cgi?id=76516 5 6 Reviewed by Kenneth Russell. 7 8 No new tests required. 9 10 * webaudio/AudioBasicProcessorNode.cpp: 11 (WebCore::AudioBasicProcessorNode::checkNumberOfChannelsForInput): 12 * webaudio/AudioChannelMerger.cpp: 13 (WebCore::AudioChannelMerger::checkNumberOfChannelsForInput): 14 * webaudio/AudioGainNode.cpp: 15 (WebCore::AudioGainNode::checkNumberOfChannelsForInput): 16 * webaudio/AudioNode.cpp: 17 (WebCore::AudioNode::checkNumberOfChannelsForInput): 18 * webaudio/AudioNode.h: 19 * webaudio/AudioNodeInput.cpp: 20 (WebCore::AudioNodeInput::AudioNodeInput): 21 (WebCore::AudioNodeInput::updateInternalBus): 22 (WebCore::AudioNodeInput::internalSummingBus): 23 * webaudio/AudioNodeInput.h: 24 1 25 2012-01-31 Alexey Proskuryakov <ap@apple.com> 2 26 -
trunk/Source/WebCore/webaudio/AudioBasicProcessorNode.cpp
r106420 r106423 128 128 initialize(); 129 129 } 130 131 AudioNode::checkNumberOfChannelsForInput(input); 130 132 } 131 133 -
trunk/Source/WebCore/webaudio/AudioChannelMerger.cpp
r96745 r106423 90 90 // Any time a connection or disconnection happens on any of our inputs, we potentially need to change the 91 91 // number of channels of our output. 92 void AudioChannelMerger::checkNumberOfChannelsForInput(AudioNodeInput* )92 void AudioChannelMerger::checkNumberOfChannelsForInput(AudioNodeInput* input) 93 93 { 94 94 ASSERT(context()->isAudioThread() && context()->isGraphOwner()); … … 106 106 ASSERT(output); 107 107 output->setNumberOfChannels(numberOfOutputChannels); 108 109 AudioNode::checkNumberOfChannelsForInput(input); 108 110 } 109 111 -
trunk/Source/WebCore/webaudio/AudioGainNode.cpp
r106420 r106423 111 111 initialize(); 112 112 } 113 114 AudioNode::checkNumberOfChannelsForInput(input); 113 115 } 114 116 -
trunk/Source/WebCore/webaudio/AudioNode.cpp
r103882 r106423 183 183 } 184 184 185 void AudioNode::checkNumberOfChannelsForInput(AudioNodeInput* input) 186 { 187 ASSERT(context()->isAudioThread() && context()->isGraphOwner()); 188 189 ASSERT(m_inputs.contains(input)); 190 if (!m_inputs.contains(input)) 191 return; 192 193 input->updateInternalBus(); 194 } 195 185 196 void AudioNode::pullInputs(size_t framesToProcess) 186 197 { -
trunk/Source/WebCore/webaudio/AudioNode.h
r103882 r106423 130 130 // This potentially gives us enough information to perform a lazy initialization or, if necessary, a re-initialization. 131 131 // Called from main thread. 132 virtual void checkNumberOfChannelsForInput(AudioNodeInput*) { }132 virtual void checkNumberOfChannelsForInput(AudioNodeInput*); 133 133 134 134 #if DEBUG_AUDIONODE_REFERENCES -
trunk/Source/WebCore/webaudio/AudioNodeInput.cpp
r95901 r106423 42 42 , m_renderingStateNeedUpdating(false) 43 43 { 44 m_monoSummingBus = adoptPtr(new AudioBus(1, AudioNode::ProcessingSizeInFrames));45 m_ stereoSummingBus = adoptPtr(new AudioBus(2, AudioNode::ProcessingSizeInFrames));44 // Set to mono by default. 45 m_internalSummingBus = adoptPtr(new AudioBus(1, AudioNode::ProcessingSizeInFrames)); 46 46 } 47 47 … … 160 160 } 161 161 162 void AudioNodeInput::updateInternalBus() 163 { 164 ASSERT(context()->isAudioThread() && context()->isGraphOwner()); 165 166 unsigned numberOfInputChannels = numberOfChannels(); 167 168 if (numberOfInputChannels == m_internalSummingBus->numberOfChannels()) 169 return; 170 171 m_internalSummingBus = adoptPtr(new AudioBus(numberOfInputChannels, AudioNode::ProcessingSizeInFrames)); 172 } 173 162 174 unsigned AudioNodeInput::numberOfChannels() const 163 175 { … … 202 214 ASSERT(context()->isAudioThread()); 203 215 204 // We must pick a summing bus which is the right size to handle the largest connection. 205 switch (numberOfRenderingChannels()) { 206 case 1: 207 return m_monoSummingBus.get(); 208 case 2: 209 return m_stereoSummingBus.get(); 210 // FIXME: could implement more than just mono and stereo mixing in the future 211 } 212 213 ASSERT_NOT_REACHED(); 214 return 0; 216 ASSERT(numberOfRenderingChannels() == m_internalSummingBus->numberOfChannels()); 217 218 return m_internalSummingBus.get(); 215 219 } 216 220 -
trunk/Source/WebCore/webaudio/AudioNodeInput.h
r95901 r106423 73 73 void updateRenderingState(); 74 74 75 // updateInternalBus() updates m_internalSummingBus appropriately for the number of channels. 76 // This must be called when we own the context's graph lock in the audio thread at the very start or end of the render quantum. 77 void updateInternalBus(); 78 75 79 // Rendering code accesses its version of the current connections here. 76 80 unsigned numberOfRenderingConnections() const { return m_renderingOutputs.size(); } … … 117 121 void sumAllConnections(AudioBus* summingBus, size_t framesToProcess); 118 122 119 OwnPtr<AudioBus> m_monoSummingBus; 120 OwnPtr<AudioBus> m_stereoSummingBus; 123 OwnPtr<AudioBus> m_internalSummingBus; 121 124 }; 122 125
Note: See TracChangeset
for help on using the changeset viewer.