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

Unified Diff: Source/core/platform/audio/chromium/AudioDestinationChromium.cpp

Issue 14628008: Require use of AudioBus::create() to avoid ref-counting issues (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 8 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
Index: Source/core/platform/audio/chromium/AudioDestinationChromium.cpp
diff --git a/Source/core/platform/audio/chromium/AudioDestinationChromium.cpp b/Source/core/platform/audio/chromium/AudioDestinationChromium.cpp
index 8506a59e0d7942c8fb2f265a1b633a5fd6a51c0c..95249957485f8905f6e710b366b8c14b17c4f5b1 100644
--- a/Source/core/platform/audio/chromium/AudioDestinationChromium.cpp
+++ b/Source/core/platform/audio/chromium/AudioDestinationChromium.cpp
@@ -53,8 +53,8 @@ PassOwnPtr<AudioDestination> AudioDestination::create(AudioIOCallback& callback,
AudioDestinationChromium::AudioDestinationChromium(AudioIOCallback& callback, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate)
: m_callback(callback)
, m_numberOfOutputChannels(numberOfOutputChannels)
- , m_inputBus(numberOfInputChannels, renderBufferSize)
- , m_renderBus(numberOfOutputChannels, renderBufferSize, false)
+ , m_inputBus(new AudioBus(numberOfInputChannels, renderBufferSize))
+ , m_renderBus(new AudioBus(numberOfOutputChannels, renderBufferSize, false))
, m_sampleRate(sampleRate)
Chris Rogers 2013/05/02 17:48:46 adoptRef()
, m_isPlaying(false)
{
@@ -83,8 +83,8 @@ AudioDestinationChromium::AudioDestinationChromium(AudioIOCallback& callback, co
// extra silence for the input. Otherwise, we can over-consume the input FIFO.
if (m_callbackBufferSize != renderBufferSize) {
// FIXME: handle multi-channel input and don't hard-code to stereo.
- AudioBus silence(2, renderBufferSize);
- m_inputFifo->push(&silence);
+ RefPtr<AudioBus> silence = adoptRef<AudioBus>(new AudioBus(2, renderBufferSize));
Chris Rogers 2013/05/02 17:48:46 Does this need to be adoptRef<AudioBus> or can it
+ m_inputFifo->push(silence.get());
}
}
@@ -143,17 +143,17 @@ void AudioDestinationChromium::render(const WebKit::WebVector<float*>& sourceDat
}
for (unsigned i = 0; i < m_numberOfOutputChannels; ++i)
- m_renderBus.setChannelMemory(i, audioData[i], numberOfFrames);
+ m_renderBus->setChannelMemory(i, audioData[i], numberOfFrames);
- m_fifo->consume(&m_renderBus, numberOfFrames);
+ m_fifo->consume(m_renderBus.get(), numberOfFrames);
}
void AudioDestinationChromium::provideInput(AudioBus* bus, size_t framesToProcess)
{
AudioBus* sourceBus = 0;
if (m_inputFifo->framesInFifo() >= framesToProcess) {
- m_inputFifo->consume(&m_inputBus, framesToProcess);
- sourceBus = &m_inputBus;
+ m_inputFifo->consume(m_inputBus.get(), framesToProcess);
+ sourceBus = m_inputBus.get();
}
m_callback.render(sourceBus, bus, framesToProcess);

Powered by Google App Engine
This is Rietveld 408576698