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

Unified Diff: third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp

Issue 2085353008: Allow disabling of resampling in decodeAudioData Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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: third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp
index 2ebf22d80ace89a6d8fa801b9e6b17ec8cd1f5c7..cbdee708ceed032239ea2270fb50a6ff8879f99d 100644
--- a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp
@@ -48,6 +48,7 @@
#include "modules/webaudio/ChannelMergerNode.h"
#include "modules/webaudio/ChannelSplitterNode.h"
#include "modules/webaudio/ConvolverNode.h"
+#include "modules/webaudio/DecodeAudioDataOptions.h"
#include "modules/webaudio/DefaultAudioDestinationNode.h"
#include "modules/webaudio/DelayNode.h"
#include "modules/webaudio/DynamicsCompressorNode.h"
@@ -278,7 +279,13 @@ AudioBuffer* BaseAudioContext::createBuffer(unsigned numberOfChannels, size_t nu
return buffer;
}
-ScriptPromise BaseAudioContext::decodeAudioData(ScriptState* scriptState, DOMArrayBuffer* audioData, AudioBufferCallback* successCallback, AudioBufferCallback* errorCallback, ExceptionState& exceptionState)
+ScriptPromise BaseAudioContext::decodeAudioData(
+ ScriptState* scriptState,
+ DOMArrayBuffer* audioData,
+ bool disableResampling,
+ AudioBufferCallback* successCallback,
+ AudioBufferCallback* errorCallback,
+ ExceptionState& exceptionState)
{
DCHECK(isMainThread());
DCHECK(audioData);
@@ -291,11 +298,41 @@ ScriptPromise BaseAudioContext::decodeAudioData(ScriptState* scriptState, DOMArr
DCHECK_GT(rate, 0);
m_decodeAudioResolvers.add(resolver);
- m_audioDecoder.decodeAsync(audioData, rate, successCallback, errorCallback, resolver, this);
+
+ m_audioDecoder.decodeAsync(
+ audioData,
+ rate,
+ disableResampling,
+ successCallback,
+ errorCallback,
+ resolver,
+ this);
return promise;
}
+ScriptPromise BaseAudioContext::decodeAudioData(ScriptState* scriptState, DOMArrayBuffer* audioData, AudioBufferCallback* successCallback, AudioBufferCallback* errorCallback, ExceptionState& exceptionState)
+{
+ return decodeAudioData(
+ scriptState,
+ audioData,
+ false,
+ successCallback,
+ errorCallback,
+ exceptionState);
+}
+
+ScriptPromise BaseAudioContext::decodeAudioData(ScriptState* scriptState, DOMArrayBuffer* audioData, const DecodeAudioDataOptions& decodeOptions, ExceptionState& exceptionState)
+{
+ return decodeAudioData(
+ scriptState,
+ audioData,
+ decodeOptions.disableResampling(),
+ nullptr,
+ nullptr,
+ exceptionState);
+}
+
void BaseAudioContext::handleDecodeAudioData(AudioBuffer* audioBuffer, ScriptPromiseResolver* resolver, AudioBufferCallback* successCallback, AudioBufferCallback* errorCallback)
{
DCHECK(isMainThread());

Powered by Google App Engine
This is Rietveld 408576698