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

Unified Diff: content/renderer/renderer_blink_platform_impl.cc

Issue 2501863003: Support for AudioContextOptions latencyHint. (Closed)
Patch Set: More fixes based on reviewer comments. Created 4 years 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: content/renderer/renderer_blink_platform_impl.cc
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
index 6bdaa6c4e881e57086e69eaf641f650e636447f5..f190bae7233a23187a331c1050be7660256f5636 100644
--- a/content/renderer/renderer_blink_platform_impl.cc
+++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -87,6 +87,7 @@
#include "third_party/WebKit/public/platform/BlameContext.h"
#include "third_party/WebKit/public/platform/FilePathConversion.h"
#include "third_party/WebKit/public/platform/URLConversion.h"
+#include "third_party/WebKit/public/platform/WebAudioLatencyHint.h"
#include "third_party/WebKit/public/platform/WebBlobRegistry.h"
#include "third_party/WebKit/public/platform/WebDeviceLightListener.h"
#include "third_party/WebKit/public/platform/WebFileInfo.h"
@@ -142,6 +143,7 @@
using blink::Platform;
using blink::WebAudioDevice;
+using blink::WebAudioLatencyHint;
using blink::WebBlobRegistry;
using blink::WebCanvasCaptureHandler;
using blink::WebDatabaseObserver;
@@ -657,16 +659,17 @@ WebDatabaseObserver* RendererBlinkPlatformImpl::databaseObserver() {
}
WebAudioDevice* RendererBlinkPlatformImpl::createAudioDevice(
- size_t buffer_size,
unsigned input_channels,
unsigned channels,
- double sample_rate,
+ const blink::WebAudioLatencyHint& latency_hint,
WebAudioDevice::RenderCallback* callback,
const blink::WebString& input_device_id,
const blink::WebSecurityOrigin& security_origin) {
// Use a mock for testing.
blink::WebAudioDevice* mock_device =
- GetContentClient()->renderer()->OverrideCreateAudioDevice(sample_rate);
+ GetContentClient()->renderer()->OverrideCreateAudioDevice(
+ GetAudioHardwareParams().sample_rate(),
+ GetAudioHardwareParams().frames_per_buffer());
if (mock_device)
return mock_device;
@@ -700,9 +703,9 @@ WebAudioDevice* RendererBlinkPlatformImpl::createAudioDevice(
layout = media::CHANNEL_LAYOUT_7_1;
break;
default:
- // If the layout is not supported (more than 9 channels), falls back to
- // discrete mode.
- layout = media::CHANNEL_LAYOUT_DISCRETE;
+ // TODO need to also pass 'channels' into RendererWebAudioDeviceImpl for
+ // CHANNEL_LAYOUT_DISCRETE
+ NOTREACHED();
}
int session_id = 0;
@@ -715,15 +718,9 @@ WebAudioDevice* RendererBlinkPlatformImpl::createAudioDevice(
input_channels = 0;
}
- // For CHANNEL_LAYOUT_DISCRETE, pass the explicit channel count along with
- // the channel layout when creating an |AudioParameters| object.
- media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
- layout, static_cast<int>(sample_rate), 16,
- buffer_size);
- params.set_channels_for_discrete(channels);
-
return new RendererWebAudioDeviceImpl(
- params, callback, session_id, static_cast<url::Origin>(security_origin));
+ layout, latency_hint, callback, session_id,
+ static_cast<url::Origin>(security_origin));
}
bool RendererBlinkPlatformImpl::loadAudioResource(

Powered by Google App Engine
This is Rietveld 408576698