Changeset 149817 in webkit
- Timestamp:
- May 9, 2013 9:13:05 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r149814 r149817 1 2013-05-09 Chris Rogers <crogers@google.com> 2 3 Require use of AudioBus::create() to avoid ref-counting issues 4 https://bugs.webkit.org/show_bug.cgi?id=115836 5 6 Reviewed by Andreas Kling. 7 8 There were a couple of places still embedding raw AudioBus objects as 9 member variables or local variables causing ref-counting problems 10 now that AudioBus is ref-counted. Make AudioBus constructor private 11 to enforce use of AudioBus::create(). 12 13 Adapted from Blink patch: 14 https://chromiumcodereview.appspot.com/14628008/ 15 16 * Modules/webaudio/AudioDestinationNode.h: 17 (WebCore::AudioDestinationNode::LocalAudioInputProvider::LocalAudioInputProvider): 18 (WebCore::AudioDestinationNode::LocalAudioInputProvider::set): 19 (WebCore::AudioDestinationNode::LocalAudioInputProvider::provideInput): 20 (LocalAudioInputProvider): 21 * Modules/webaudio/AudioNodeInput.cpp: 22 (WebCore::AudioNodeInput::AudioNodeInput): 23 (WebCore::AudioNodeInput::updateInternalBus): 24 * Modules/webaudio/AudioNodeOutput.cpp: 25 (WebCore::AudioNodeOutput::AudioNodeOutput): 26 (WebCore::AudioNodeOutput::updateInternalBus): 27 * Modules/webaudio/AudioParam.cpp: 28 (WebCore::AudioParam::calculateFinalValues): 29 * Modules/webaudio/ConvolverNode.cpp: 30 (WebCore::ConvolverNode::setBuffer): 31 * Modules/webaudio/MediaStreamAudioDestinationNode.cpp: 32 (WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode): 33 (WebCore::MediaStreamAudioDestinationNode::process): 34 * Modules/webaudio/MediaStreamAudioDestinationNode.h: 35 * Modules/webaudio/OfflineAudioDestinationNode.cpp: 36 (WebCore::OfflineAudioDestinationNode::OfflineAudioDestinationNode): 37 * Modules/webaudio/ScriptProcessorNode.cpp: 38 (WebCore::ScriptProcessorNode::ScriptProcessorNode): 39 (WebCore::ScriptProcessorNode::process): 40 * Modules/webaudio/ScriptProcessorNode.h: 41 (ScriptProcessorNode): 42 * platform/audio/AudioBus.cpp: 43 (WebCore::AudioBus::create): 44 (WebCore): 45 (WebCore::AudioBus::AudioBus): 46 (WebCore::AudioBus::createBufferFromRange): 47 (WebCore::AudioBus::createBySampleRateConverting): 48 (WebCore::AudioBus::createByMixingToMono): 49 * platform/audio/AudioBus.h: 50 (AudioBus): 51 * platform/audio/AudioFIFO.cpp: 52 (WebCore::AudioFIFO::AudioFIFO): 53 (WebCore::AudioFIFO::consume): 54 (WebCore::AudioFIFO::push): 55 * platform/audio/AudioFIFO.h: 56 (AudioFIFO): 57 * platform/audio/AudioPullFIFO.cpp: 58 (WebCore::AudioPullFIFO::AudioPullFIFO): 59 (WebCore::AudioPullFIFO::fillBuffer): 60 * platform/audio/AudioPullFIFO.h: 61 (AudioPullFIFO): 62 * platform/audio/AudioResampler.cpp: 63 (WebCore::AudioResampler::AudioResampler): 64 (WebCore::AudioResampler::configureChannels): 65 * platform/audio/MultiChannelResampler.cpp: 66 * platform/audio/Reverb.cpp: 67 (WebCore::Reverb::initialize): 68 * platform/audio/SincResampler.cpp: 69 (WebCore::SincResampler::consumeSource): 70 (WebCore): 71 * platform/audio/gstreamer/AudioDestinationGStreamer.cpp: 72 (WebCore::AudioDestinationGStreamer::AudioDestinationGStreamer): 73 * platform/audio/gstreamer/AudioDestinationGStreamer.h: 74 (AudioDestinationGStreamer): 75 * platform/audio/gstreamer/AudioFileReaderGStreamer.cpp: 76 (WebCore::AudioFileReader::createBus): 77 * platform/audio/ios/AudioDestinationIOS.cpp: 78 (WebCore::AudioDestinationIOS::AudioDestinationIOS): 79 (WebCore::AudioDestinationIOS::render): 80 * platform/audio/ios/AudioDestinationIOS.h: 81 (AudioDestinationIOS): 82 * platform/audio/mac/AudioDestinationMac.cpp: 83 (WebCore::AudioDestinationMac::AudioDestinationMac): 84 (WebCore::AudioDestinationMac::render): 85 * platform/audio/mac/AudioDestinationMac.h: 86 (AudioDestinationMac): 87 * platform/audio/mac/AudioFileReaderMac.cpp: 88 (WebCore::AudioFileReader::createBus): 89 1 90 2013-05-09 Alberto Garcia <agarcia@igalia.com> 2 91 -
trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.h
r144720 r149817 68 68 public: 69 69 LocalAudioInputProvider() 70 : m_sourceBus( 2, AudioNode::ProcessingSizeInFrames) // FIXME: handle non-stereo local input.70 : m_sourceBus(AudioBus::create(2, AudioNode::ProcessingSizeInFrames)) // FIXME: handle non-stereo local input. 71 71 { 72 72 } … … 75 75 { 76 76 if (bus) 77 m_sourceBus .copyFrom(*bus);77 m_sourceBus->copyFrom(*bus); 78 78 } 79 79 … … 81 81 virtual void provideInput(AudioBus* destinationBus, size_t numberOfFrames) 82 82 { 83 bool isGood = destinationBus && destinationBus->length() == numberOfFrames && m_sourceBus .length() == numberOfFrames;83 bool isGood = destinationBus && destinationBus->length() == numberOfFrames && m_sourceBus->length() == numberOfFrames; 84 84 ASSERT(isGood); 85 85 if (isGood) 86 destinationBus->copyFrom( m_sourceBus);86 destinationBus->copyFrom(*m_sourceBus); 87 87 } 88 88 89 89 private: 90 AudioBusm_sourceBus;90 RefPtr<AudioBus> m_sourceBus; 91 91 }; 92 92 -
trunk/Source/WebCore/Modules/webaudio/AudioNodeInput.cpp
r149778 r149817 43 43 { 44 44 // Set to mono by default. 45 m_internalSummingBus = adoptRef(new AudioBus(1, AudioNode::ProcessingSizeInFrames));45 m_internalSummingBus = AudioBus::create(1, AudioNode::ProcessingSizeInFrames); 46 46 } 47 47 … … 145 145 return; 146 146 147 m_internalSummingBus = adoptRef(new AudioBus(numberOfInputChannels, AudioNode::ProcessingSizeInFrames));147 m_internalSummingBus = AudioBus::create(numberOfInputChannels, AudioNode::ProcessingSizeInFrames); 148 148 } 149 149 -
trunk/Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp
r149778 r149817 48 48 ASSERT(numberOfChannels <= AudioContext::maxNumberOfChannels()); 49 49 50 m_internalBus = adoptRef(new AudioBus(numberOfChannels, AudioNode::ProcessingSizeInFrames));50 m_internalBus = AudioBus::create(numberOfChannels, AudioNode::ProcessingSizeInFrames); 51 51 } 52 52 … … 72 72 return; 73 73 74 m_internalBus = adoptRef(new AudioBus(numberOfChannels(), AudioNode::ProcessingSizeInFrames));74 m_internalBus = AudioBus::create(numberOfChannels(), AudioNode::ProcessingSizeInFrames); 75 75 } 76 76 -
trunk/Source/WebCore/Modules/webaudio/AudioParam.cpp
r142810 r149817 137 137 // Now sum all of the audio-rate connections together (unity-gain summing junction). 138 138 // Note that connections would normally be mono, but we mix down to mono if necessary. 139 AudioBus summingBus(1, numberOfValues, false);140 summingBus .setChannelMemory(0, values, numberOfValues);139 RefPtr<AudioBus> summingBus = AudioBus::create(1, numberOfValues, false); 140 summingBus->setChannelMemory(0, values, numberOfValues); 141 141 142 142 for (unsigned i = 0; i < numberOfRenderingConnections(); ++i) { … … 148 148 149 149 // Sum, with unity-gain. 150 summingBus .sumFrom(*connectionBus);150 summingBus->sumFrom(*connectionBus); 151 151 } 152 152 } -
trunk/Source/WebCore/Modules/webaudio/ConvolverNode.cpp
r144235 r149817 133 133 // Wrap the AudioBuffer by an AudioBus. It's an efficient pointer set and not a memcpy(). 134 134 // This memory is simply used in the Reverb constructor and no reference to it is kept for later use in that class. 135 AudioBus bufferBus(numberOfChannels, bufferLength, false);135 RefPtr<AudioBus> bufferBus = AudioBus::create(numberOfChannels, bufferLength, false); 136 136 for (unsigned i = 0; i < numberOfChannels; ++i) 137 bufferBus .setChannelMemory(i, buffer->getChannelData(i)->data(), bufferLength);137 bufferBus->setChannelMemory(i, buffer->getChannelData(i)->data(), bufferLength); 138 138 139 bufferBus .setSampleRate(buffer->sampleRate());139 bufferBus->setSampleRate(buffer->sampleRate()); 140 140 141 141 // Create the reverb with the given impulse response. 142 142 bool useBackgroundThreads = !context()->isOfflineContext(); 143 OwnPtr<Reverb> reverb = adoptPtr(new Reverb( &bufferBus, AudioNode::ProcessingSizeInFrames, MaxFFTSize, 2, useBackgroundThreads, m_normalize));143 OwnPtr<Reverb> reverb = adoptPtr(new Reverb(bufferBus.get(), AudioNode::ProcessingSizeInFrames, MaxFFTSize, 2, useBackgroundThreads, m_normalize)); 144 144 145 145 { -
trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp
r149175 r149817 46 46 MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(AudioContext* context, size_t numberOfChannels) 47 47 : AudioBasicInspectorNode(context, context->sampleRate(), numberOfChannels) 48 , m_mixBus( numberOfChannels, ProcessingSizeInFrames)48 , m_mixBus(AudioBus::create(numberOfChannels, ProcessingSizeInFrames)) 49 49 { 50 50 setNodeType(NodeTypeMediaStreamAudioDestination); … … 74 74 void MediaStreamAudioDestinationNode::process(size_t numberOfFrames) 75 75 { 76 m_mixBus .copyFrom(*input(0)->bus());77 m_source->consumeAudio( &m_mixBus, numberOfFrames);76 m_mixBus->copyFrom(*input(0)->bus()); 77 m_source->consumeAudio(m_mixBus.get(), numberOfFrames); 78 78 } 79 79 -
trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.h
r135985 r149817 63 63 RefPtr<MediaStream> m_stream; 64 64 RefPtr<MediaStreamSource> m_source; 65 AudioBusm_mixBus;65 RefPtr<AudioBus> m_mixBus; 66 66 }; 67 67 -
trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp
r149778 r149817 47 47 , m_startedRendering(false) 48 48 { 49 m_renderBus = adoptRef(new AudioBus(renderTarget->numberOfChannels(), renderQuantumSize));49 m_renderBus = AudioBus::create(renderTarget->numberOfChannels(), renderQuantumSize); 50 50 } 51 51 -
trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp
r135156 r149817 80 80 , m_numberOfInputChannels(numberOfInputChannels) 81 81 , m_numberOfOutputChannels(numberOfOutputChannels) 82 , m_internalInputBus( numberOfInputChannels, AudioNode::ProcessingSizeInFrames, false)82 , m_internalInputBus(AudioBus::create(numberOfInputChannels, AudioNode::ProcessingSizeInFrames, false)) 83 83 { 84 84 // Regardless of the allowed buffer sizes, we still need to process at the granularity of the AudioNode. … … 155 155 156 156 // Check the consistency of input and output buffers. 157 unsigned numberOfInputChannels = m_internalInputBus .numberOfChannels();157 unsigned numberOfInputChannels = m_internalInputBus->numberOfChannels(); 158 158 bool buffersAreGood = outputBuffer && bufferSize() == outputBuffer->length() && m_bufferReadWriteIndex + framesToProcess <= bufferSize(); 159 159 160 160 // If the number of input channels is zero, it's ok to have inputBuffer = 0. 161 if (m_internalInputBus .numberOfChannels())161 if (m_internalInputBus->numberOfChannels()) 162 162 buffersAreGood = buffersAreGood && inputBuffer && bufferSize() == inputBuffer->length(); 163 163 … … 180 180 181 181 for (unsigned i = 0; i < numberOfInputChannels; i++) 182 m_internalInputBus .setChannelMemory(i, inputBuffer->getChannelData(i)->data() + m_bufferReadWriteIndex, framesToProcess);182 m_internalInputBus->setChannelMemory(i, inputBuffer->getChannelData(i)->data() + m_bufferReadWriteIndex, framesToProcess); 183 183 184 184 if (numberOfInputChannels) 185 m_internalInputBus .copyFrom(*inputBus);185 m_internalInputBus->copyFrom(*inputBus); 186 186 187 187 // Copy from the output buffer to the output. -
trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.h
r131486 r149817 107 107 unsigned m_numberOfOutputChannels; 108 108 109 AudioBusm_internalInputBus;109 RefPtr<AudioBus> m_internalInputBus; 110 110 }; 111 111 -
trunk/Source/WebCore/platform/audio/AudioBus.cpp
r149778 r149817 49 49 const unsigned MaxBusChannels = 32; 50 50 51 PassRefPtr<AudioBus> AudioBus::create(unsigned numberOfChannels, size_t length, bool allocate) 52 { 53 ASSERT(numberOfChannels <= MaxBusChannels); 54 if (numberOfChannels > MaxBusChannels) 55 return 0; 56 57 return adoptRef(new AudioBus(numberOfChannels, length, allocate)); 58 } 59 51 60 AudioBus::AudioBus(unsigned numberOfChannels, size_t length, bool allocate) 52 61 : m_length(length) … … 55 64 , m_sampleRate(0) 56 65 { 57 ASSERT(numberOfChannels <= MaxBusChannels);58 if (numberOfChannels > MaxBusChannels)59 return;60 61 66 m_channels.reserveInitialCapacity(numberOfChannels); 62 67 … … 178 183 size_t rangeLength = endFrame - startFrame; 179 184 180 RefPtr<AudioBus> audioBus = adoptRef(new AudioBus(numberOfChannels, rangeLength));185 RefPtr<AudioBus> audioBus = create(numberOfChannels, rangeLength); 181 186 audioBus->setSampleRate(sourceBuffer->sampleRate()); 182 187 … … 544 549 545 550 if (sourceBus->isSilent()) { 546 RefPtr<AudioBus> silentBus = adoptRef(new AudioBus(numberOfSourceChannels, sourceBus->length() / sampleRateRatio));551 RefPtr<AudioBus> silentBus = create(numberOfSourceChannels, sourceBus->length() / sampleRateRatio); 547 552 silentBus->setSampleRate(newSampleRate); 548 553 return silentBus; … … 566 571 // Create destination bus with same number of channels. 567 572 unsigned numberOfDestinationChannels = resamplerSourceBus->numberOfChannels(); 568 RefPtr<AudioBus> destinationBus (adoptRef(new AudioBus(numberOfDestinationChannels, destinationLength)));573 RefPtr<AudioBus> destinationBus = create(numberOfDestinationChannels, destinationLength); 569 574 570 575 // Sample-rate convert each channel. … … 585 590 { 586 591 if (sourceBus->isSilent()) 587 return adoptRef(new AudioBus(1, sourceBus->length()));592 return create(1, sourceBus->length()); 588 593 589 594 switch (sourceBus->numberOfChannels()) { … … 594 599 { 595 600 unsigned n = sourceBus->length(); 596 RefPtr<AudioBus> destinationBus (adoptRef(new AudioBus(1, n)));601 RefPtr<AudioBus> destinationBus = create(1, n); 597 602 598 603 const float* sourceL = sourceBus->channel(0)->data(); -
trunk/Source/WebCore/platform/audio/AudioBus.h
r149778 r149817 67 67 // Normal usage is to pass true here, in which case the AudioChannels will memory-manage their own storage. 68 68 // If allocate is false then setChannelMemory() has to be called later on for each channel before the AudioBus is useable... 69 AudioBus(unsigned numberOfChannels, size_t length, bool allocate = true);69 static PassRefPtr<AudioBus> create(unsigned numberOfChannels, size_t length, bool allocate = true); 70 70 71 71 // Tells the given channel to use an externally allocated buffer. … … 150 150 AudioBus() { }; 151 151 152 AudioBus(unsigned numberOfChannels, size_t length, bool allocate); 153 152 154 void speakersCopyFrom(const AudioBus&); 153 155 void discreteCopyFrom(const AudioBus&); -
trunk/Source/WebCore/platform/audio/AudioFIFO.cpp
r141816 r149817 36 36 37 37 AudioFIFO::AudioFIFO(unsigned numberOfChannels, size_t fifoLength) 38 : m_fifoAudioBus( numberOfChannels, fifoLength)38 : m_fifoAudioBus(AudioBus::create(numberOfChannels, fifoLength)) 39 39 , m_fifoLength(fifoLength) 40 40 , m_framesInFifo(0) … … 57 57 findWrapLengths(m_readIndex, framesToConsume, part1Length, part2Length); 58 58 59 size_t numberOfChannels = m_fifoAudioBus .numberOfChannels();59 size_t numberOfChannels = m_fifoAudioBus->numberOfChannels(); 60 60 61 61 for (size_t channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex) { 62 62 float* destinationData = destination->channel(channelIndex)->mutableData(); 63 const float* sourceData = m_fifoAudioBus .channel(channelIndex)->data();63 const float* sourceData = m_fifoAudioBus->channel(channelIndex)->data(); 64 64 65 65 bool isCopyGood = ((m_readIndex < m_fifoLength) … … 94 94 findWrapLengths(m_writeIndex, sourceLength, part1Length, part2Length); 95 95 96 size_t numberOfChannels = m_fifoAudioBus .numberOfChannels();96 size_t numberOfChannels = m_fifoAudioBus->numberOfChannels(); 97 97 98 98 for (size_t channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex) { 99 float* destination = m_fifoAudioBus .channel(channelIndex)->mutableData();99 float* destination = m_fifoAudioBus->channel(channelIndex)->mutableData(); 100 100 const float* source = sourceBus->channel(channelIndex)->data(); 101 101 -
trunk/Source/WebCore/platform/audio/AudioFIFO.h
r121810 r149817 56 56 57 57 // The FIFO itself. In reality, the FIFO is a circular buffer. 58 AudioBusm_fifoAudioBus;58 RefPtr<AudioBus> m_fifoAudioBus; 59 59 60 60 // The total available space in the FIFO. -
trunk/Source/WebCore/platform/audio/AudioPullFIFO.cpp
r121810 r149817 39 39 , m_fifo(numberOfChannels, fifoLength) 40 40 , m_providerSize(providerSize) 41 , m_tempBus( numberOfChannels, providerSize)41 , m_tempBus(AudioBus::create(numberOfChannels, providerSize)) 42 42 { 43 43 } … … 63 63 64 64 while (framesProvided < numberOfFrames) { 65 m_provider.provideInput( &m_tempBus, m_providerSize);65 m_provider.provideInput(m_tempBus.get(), m_providerSize); 66 66 67 m_fifo.push( &m_tempBus);67 m_fifo.push(m_tempBus.get()); 68 68 69 69 framesProvided += m_providerSize; -
trunk/Source/WebCore/platform/audio/AudioPullFIFO.h
r121810 r149817 67 67 68 68 // Temporary workspace to hold the data from the provider. 69 AudioBusm_tempBus;69 RefPtr<AudioBus> m_tempBus; 70 70 }; 71 71 -
trunk/Source/WebCore/platform/audio/AudioResampler.cpp
r149778 r149817 43 43 { 44 44 m_kernels.append(adoptPtr(new AudioResamplerKernel(this))); 45 m_sourceBus = adoptRef(new AudioBus(1, 0, false));45 m_sourceBus = AudioBus::create(1, 0, false); 46 46 } 47 47 … … 52 52 m_kernels.append(adoptPtr(new AudioResamplerKernel(this))); 53 53 54 m_sourceBus = adoptRef(new AudioBus(numberOfChannels, 0, false));54 m_sourceBus = AudioBus::create(numberOfChannels, 0, false); 55 55 } 56 56 … … 69 69 70 70 // Reconfigure our source bus to the new channel size. 71 m_sourceBus = adoptRef(new AudioBus(numberOfChannels, 0, false));71 m_sourceBus = AudioBus::create(numberOfChannels, 0, false); 72 72 } 73 73 -
trunk/Source/WebCore/platform/audio/MultiChannelResampler.cpp
r149778 r149817 65 65 if (!m_currentChannel) { 66 66 m_framesToProcess = framesToProcess; 67 m_multiChannelBus = adoptRef(new AudioBus(m_numberOfChannels, framesToProcess));67 m_multiChannelBus = AudioBus::create(m_numberOfChannels, framesToProcess); 68 68 m_multiChannelProvider->provideInput(m_multiChannelBus.get(), framesToProcess); 69 69 } -
trunk/Source/WebCore/platform/audio/Reverb.cpp
r149778 r149817 133 133 // It can be bad to allocate memory in a real-time thread. 134 134 if (numResponseChannels == 4) 135 m_tempBuffer = adoptRef(new AudioBus(2, MaxFrameSize));135 m_tempBuffer = AudioBus::create(2, MaxFrameSize); 136 136 } 137 137 -
trunk/Source/WebCore/platform/audio/SincResampler.cpp
r105431 r149817 135 135 136 136 // Wrap the provided buffer by an AudioBus for use by the source provider. 137 AudioBus bus(1, numberOfSourceFrames, false);137 RefPtr<AudioBus> bus = AudioBus::create(1, numberOfSourceFrames, false); 138 138 139 139 // FIXME: Find a way to make the following const-correct: 140 bus .setChannelMemory(0, buffer, numberOfSourceFrames);141 142 m_sourceProvider->provideInput( &bus, numberOfSourceFrames);140 bus->setChannelMemory(0, buffer, numberOfSourceFrames); 141 142 m_sourceProvider->provideInput(bus.get(), numberOfSourceFrames); 143 143 } 144 144 -
trunk/Source/WebCore/platform/audio/gstreamer/AudioDestinationGStreamer.cpp
r145808 r149817 80 80 AudioDestinationGStreamer::AudioDestinationGStreamer(AudioIOCallback& callback, float sampleRate) 81 81 : m_callback(callback) 82 , m_renderBus( 2, framesToPull, false)82 , m_renderBus(AudioBus::create(2, framesToPull, false)) 83 83 , m_sampleRate(sampleRate) 84 84 , m_isPlaying(false) … … 92 92 GstElement* webkitAudioSrc = reinterpret_cast<GstElement*>(g_object_new(WEBKIT_TYPE_WEB_AUDIO_SRC, 93 93 "rate", sampleRate, 94 "bus", &m_renderBus,94 "bus", m_renderBus.get(), 95 95 "provider", &m_callback, 96 96 "frames", framesToPull, NULL)); -
trunk/Source/WebCore/platform/audio/gstreamer/AudioDestinationGStreamer.h
r138786 r149817 22 22 #include "AudioBus.h" 23 23 #include "AudioDestination.h" 24 #include <wtf/RefPtr.h> 24 25 25 26 typedef struct _GstElement GstElement; … … 46 47 private: 47 48 AudioIOCallback& m_callback; 48 AudioBusm_renderBus;49 RefPtr<AudioBus> m_renderBus; 49 50 50 51 float m_sampleRate; -
trunk/Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp
r149778 r149817 468 468 469 469 unsigned channels = mixToMono ? 1 : 2; 470 RefPtr<AudioBus> audioBus = adoptRef(new AudioBus(channels, m_channelSize, true));470 RefPtr<AudioBus> audioBus = AudioBus::create(channels, m_channelSize, true); 471 471 audioBus->setSampleRate(m_sampleRate); 472 472 -
trunk/Source/WebCore/platform/audio/ios/AudioDestinationIOS.cpp
r147494 r149817 102 102 : m_outputUnit(0) 103 103 , m_callback(callback) 104 , m_renderBus( 2, kRenderBufferSize, false)104 , m_renderBus(AudioBus::create(2, kRenderBufferSize, false)) 105 105 , m_sampleRate(sampleRate) 106 106 , m_isPlaying(false) … … 236 236 UInt32 byteOffset = frameOffset * bytesPerFrame; 237 237 float* memory = (float*)((char*)buffers[i].mData + byteOffset); 238 m_renderBus .setChannelMemory(i, memory, remainingFrames);238 m_renderBus->setChannelMemory(i, memory, remainingFrames); 239 239 } 240 m_callback.render(0, &m_renderBus, remainingFrames);240 m_callback.render(0, m_renderBus.get(), remainingFrames); 241 241 } 242 242 -
trunk/Source/WebCore/platform/audio/ios/AudioDestinationIOS.h
r147561 r149817 35 35 #include "AudioSessionListener.h" 36 36 #include <AudioUnit/AudioUnit.h> 37 #include <wtf/RefPtr.h> 37 38 38 39 namespace WebCore { … … 66 67 AudioUnit m_outputUnit; 67 68 AudioIOCallback& m_callback; 68 AudioBusm_renderBus;69 RefPtr<AudioBus> m_renderBus; 69 70 70 71 double m_sampleRate; -
trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.cpp
r144720 r149817 95 95 : m_outputUnit(0) 96 96 , m_callback(callback) 97 , m_renderBus( 2, kBufferSize, false)97 , m_renderBus(AudioBus::create(2, kBufferSize, false)) 98 98 , m_sampleRate(sampleRate) 99 99 , m_isPlaying(false) … … 176 176 { 177 177 AudioBuffer* buffers = ioData->mBuffers; 178 m_renderBus .setChannelMemory(0, (float*)buffers[0].mData, numberOfFrames);179 m_renderBus .setChannelMemory(1, (float*)buffers[1].mData, numberOfFrames);178 m_renderBus->setChannelMemory(0, (float*)buffers[0].mData, numberOfFrames); 179 m_renderBus->setChannelMemory(1, (float*)buffers[1].mData, numberOfFrames); 180 180 181 181 // FIXME: Add support for local/live audio input. 182 m_callback.render(0, &m_renderBus, numberOfFrames);182 m_callback.render(0, m_renderBus.get(), numberOfFrames); 183 183 184 184 // Clamp values at 0db (i.e., [-1.0, 1.0]) 185 for (unsigned i = 0; i < m_renderBus .numberOfChannels(); ++i) {186 AudioChannel* channel = m_renderBus .channel(i);185 for (unsigned i = 0; i < m_renderBus->numberOfChannels(); ++i) { 186 AudioChannel* channel = m_renderBus->channel(i); 187 187 VectorMath::vclip(channel->data(), 1, &kLowThreshold, &kHighThreshold, channel->mutableData(), 1, numberOfFrames); 188 188 } -
trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.h
r124264 r149817 33 33 #include "AudioDestination.h" 34 34 #include <AudioUnit/AudioUnit.h> 35 #include <wtf/RefPtr.h> 35 36 36 37 namespace WebCore { … … 59 60 AudioUnit m_outputUnit; 60 61 AudioIOCallback& m_callback; 61 AudioBusm_renderBus;62 RefPtr<AudioBus> m_renderBus; 62 63 63 64 float m_sampleRate; -
trunk/Source/WebCore/platform/audio/mac/AudioFileReaderMac.cpp
r149778 r149817 179 179 180 180 // Create AudioBus where we'll put the PCM audio data 181 RefPtr<AudioBus> audioBus = adoptRef(new AudioBus(busChannelCount, numberOfFrames));181 RefPtr<AudioBus> audioBus = AudioBus::create(busChannelCount, numberOfFrames); 182 182 audioBus->setSampleRate(narrowPrecisionToFloat(m_clientDataFormat.mSampleRate)); // save for later 183 183
Note: See TracChangeset
for help on using the changeset viewer.