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

Unified Diff: Source/modules/webaudio/AsyncAudioDecoder.cpp

Issue 205173002: Move webaudio to oilpan (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 7 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
« no previous file with comments | « Source/modules/webaudio/AsyncAudioDecoder.h ('k') | Source/modules/webaudio/AudioBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webaudio/AsyncAudioDecoder.cpp
diff --git a/Source/modules/webaudio/AsyncAudioDecoder.cpp b/Source/modules/webaudio/AsyncAudioDecoder.cpp
index f1ea34f4c71456fad2716838e7c95099aba78e67..db7cedaaf62e3468649e411d91003eb38400af9b 100644
--- a/Source/modules/webaudio/AsyncAudioDecoder.cpp
+++ b/Source/modules/webaudio/AsyncAudioDecoder.cpp
@@ -31,6 +31,8 @@
#include "modules/webaudio/AudioBuffer.h"
#include "modules/webaudio/AudioBufferCallback.h"
#include "platform/Task.h"
+#include "platform/audio/AudioBus.h"
+#include "platform/audio/AudioFileReader.h"
#include "public/platform/Platform.h"
#include "wtf/ArrayBuffer.h"
#include "wtf/MainThread.h"
@@ -63,26 +65,26 @@ void AsyncAudioDecoder::decodeAsync(ArrayBuffer* audioData, float sampleRate, Pa
void AsyncAudioDecoder::decode(ArrayBuffer* audioData, float sampleRate, AudioBufferCallback* successCallback, AudioBufferCallback* errorCallback)
{
- // Do the actual decoding and invoke the callback.
- RefPtr<AudioBuffer> audioBuffer = AudioBuffer::createFromAudioFileData(audioData->data(), audioData->byteLength(), false, sampleRate);
+ RefPtr<AudioBus> bus = createBusFromInMemoryAudioFile(audioData->data(), audioData->byteLength(), false, sampleRate);
// Decoding is finished, but we need to do the callbacks on the main thread.
// The leaked reference to audioBuffer is picked up in notifyComplete.
- callOnMainThread(WTF::bind(&AsyncAudioDecoder::notifyComplete, audioData, successCallback, errorCallback, audioBuffer.release().leakRef()));
+ callOnMainThread(WTF::bind(&AsyncAudioDecoder::notifyComplete, audioData, successCallback, errorCallback, bus.release().leakRef()));
}
-void AsyncAudioDecoder::notifyComplete(ArrayBuffer* audioData, AudioBufferCallback* successCallback, AudioBufferCallback* errorCallback, AudioBuffer* audioBuffer)
+void AsyncAudioDecoder::notifyComplete(ArrayBuffer* audioData, AudioBufferCallback* successCallback, AudioBufferCallback* errorCallback, AudioBus* audioBus)
{
// Adopt references, so everything gets correctly dereffed.
RefPtr<ArrayBuffer> audioDataRef = adoptRef(audioData);
OwnPtr<AudioBufferCallback> successCallbackPtr = adoptPtr(successCallback);
OwnPtr<AudioBufferCallback> errorCallbackPtr = adoptPtr(errorCallback);
- RefPtr<AudioBuffer> audioBufferRef = adoptRef(audioBuffer);
+ RefPtr<AudioBus> audioBusRef = adoptRef(audioBus);
- if (audioBuffer && successCallback)
- successCallback->handleEvent(audioBuffer);
+ RefPtrWillBeRawPtr<AudioBuffer> audioBuffer = AudioBuffer::createFromAudioBus(audioBus);
+ if (audioBuffer.get() && successCallback)
+ successCallback->handleEvent(audioBuffer.get());
else if (errorCallback)
- errorCallback->handleEvent(audioBuffer);
+ errorCallback->handleEvent(audioBuffer.get());
}
} // namespace WebCore
« no previous file with comments | « Source/modules/webaudio/AsyncAudioDecoder.h ('k') | Source/modules/webaudio/AudioBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698