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

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

Issue 2501863003: Support for AudioContextOptions latencyHint. (Closed)
Patch Set: Add baseLatency and fix use of hardwareSampleRate. Created 4 years, 1 month 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 020e539047db244fcc9878bc8f9e5da1fe0beefa..d162337bd930b9e79f47b8ffb29dce60a7d43e64 100644
--- a/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp
@@ -44,6 +44,7 @@
#include "modules/webaudio/AudioBufferCallback.h"
#include "modules/webaudio/AudioBufferSourceNode.h"
#include "modules/webaudio/AudioContext.h"
+#include "modules/webaudio/AudioContextOptions.h"
#include "modules/webaudio/AudioListener.h"
#include "modules/webaudio/AudioNodeInput.h"
#include "modules/webaudio/AudioNodeOutput.h"
@@ -75,20 +76,24 @@
#include "platform/UserGestureIndicator.h"
#include "platform/audio/IIRFilter.h"
#include "public/platform/Platform.h"
+#include "public/platform/WebAudioLatencyHint.h"
#include "wtf/text/WTFString.h"
namespace blink {
-BaseAudioContext* BaseAudioContext::create(Document& document,
- ExceptionState& exceptionState) {
- return AudioContext::create(document, exceptionState);
+BaseAudioContext* BaseAudioContext::create(
+ Document& document,
+ const WebAudioLatencyHint& latencyHint,
+ ExceptionState& exceptionState) {
+ return AudioContext::create(document, latencyHint, exceptionState);
}
// FIXME(dominicc): Devolve these constructors to AudioContext
// and OfflineAudioContext respectively.
// Constructor for rendering to the audio hardware.
-BaseAudioContext::BaseAudioContext(Document* document)
+BaseAudioContext::BaseAudioContext(Document* document,
+ const WebAudioLatencyHint& latencyHint)
: ActiveScriptWrappable(this),
ActiveDOMObject(document),
m_destinationNode(nullptr),
@@ -112,7 +117,7 @@ BaseAudioContext::BaseAudioContext(Document* document)
m_userGestureRequired = true;
}
- m_destinationNode = DefaultAudioDestinationNode::create(this);
+ m_destinationNode = DefaultAudioDestinationNode::create(this, latencyHint);
initialize();
}
@@ -590,6 +595,10 @@ String BaseAudioContext::state() const {
return "";
}
+double BaseAudioContext::baseLatency() const {
+ return framesPerBuffer() * 2 / sampleRate();
Raymond Toy 2016/11/30 21:50:27 Cast sampleRate() to double so that we get double
Andrew MacPherson 2016/12/01 12:11:56 Done.
+}
+
void BaseAudioContext::setContextState(AudioContextState newState) {
DCHECK(isMainThread());

Powered by Google App Engine
This is Rietveld 408576698