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

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

Issue 2750543003: Support AudioContextOptions latencyHint as double. (Closed)
Patch Set: Refactor audiocontextoptions LayoutTest. Created 3 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: third_party/WebKit/Source/modules/webaudio/AudioContext.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp b/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp
index 21a5d05b528360cc638fcca0891a943ee0bdb3a9..be3e30138ccba5d8b92df05bc6f0d07c86efa08d 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp
@@ -54,8 +54,12 @@ AudioContext* AudioContext::Create(Document& document,
if (context_options.latencyHint().isAudioContextLatencyCategory()) {
latency_hint = WebAudioLatencyHint(
context_options.latencyHint().getAsAudioContextLatencyCategory());
+ } else if (context_options.latencyHint().isDouble()) {
+ // This should be the requested output latency in seconds, without taking
+ // into account double buffering (same as baseLatency).
+ latency_hint =
+ WebAudioLatencyHint(context_options.latencyHint().getAsDouble());
}
- // TODO: add support for latencyHint().isDouble()
AudioContext* audio_context = new AudioContext(document, latency_hint);
audio_context->SuspendIfNeeded();
@@ -264,7 +268,7 @@ void AudioContext::StopRendering() {
}
double AudioContext::baseLatency() const {
- return FramesPerBuffer() * 2 / static_cast<double>(sampleRate());
+ return FramesPerBuffer() / static_cast<double>(sampleRate());
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698