OLD | NEW |
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 m_internalSummingBus = adoptPtr(new AudioBus(numberOfInputChannels, AudioNod
e::ProcessingSizeInFrames)); | 147 m_internalSummingBus = adoptPtr(new AudioBus(numberOfInputChannels, AudioNod
e::ProcessingSizeInFrames)); |
148 } | 148 } |
149 | 149 |
150 unsigned AudioNodeInput::numberOfChannels() const | 150 unsigned AudioNodeInput::numberOfChannels() const |
151 { | 151 { |
152 // Find the number of channels of the connection with the largest number of
channels. | 152 // Find the number of channels of the connection with the largest number of
channels. |
153 unsigned maxChannels = 1; // one channel is the minimum allowed | 153 unsigned maxChannels = 1; // one channel is the minimum allowed |
154 | 154 |
155 for (HashSet<AudioNodeOutput*>::iterator i = m_outputs.begin(); i != m_outpu
ts.end(); ++i) { | 155 for (HashSet<AudioNodeOutput*>::iterator i = m_outputs.begin(); i != m_outpu
ts.end(); ++i) { |
156 AudioNodeOutput* output = *i; | 156 AudioNodeOutput* output = *i; |
157 maxChannels = max(maxChannels, output->bus()->numberOfChannels()); | 157 // Use output()->numberOfChannels() instead of output->bus()->numberOfCh
annels(), |
| 158 // because the calling of AudioNodeOutput::bus() is not safe here. |
| 159 maxChannels = max(maxChannels, output->numberOfChannels()); |
158 } | 160 } |
159 | 161 |
160 return maxChannels; | 162 return maxChannels; |
161 } | 163 } |
162 | 164 |
163 unsigned AudioNodeInput::numberOfRenderingChannels() | 165 unsigned AudioNodeInput::numberOfRenderingChannels() |
164 { | 166 { |
165 ASSERT(context()->isAudioThread()); | 167 ASSERT(context()->isAudioThread()); |
166 | 168 |
167 // Find the number of channels of the rendering connection with the largest
number of channels. | 169 // Find the number of channels of the rendering connection with the largest
number of channels. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 243 |
242 // Handle multiple connections case. | 244 // Handle multiple connections case. |
243 sumAllConnections(internalSummingBus, framesToProcess); | 245 sumAllConnections(internalSummingBus, framesToProcess); |
244 | 246 |
245 return internalSummingBus; | 247 return internalSummingBus; |
246 } | 248 } |
247 | 249 |
248 } // namespace WebCore | 250 } // namespace WebCore |
249 | 251 |
250 #endif // ENABLE(WEB_AUDIO) | 252 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |