| Index: content/renderer/renderer_webkitplatformsupport_impl.cc
|
| diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc
|
| index 3c674fdb8e14b5c5b556af596631dac3409a0cda..3ae64a6e319700f5e9d18a64491f726622cfd3bc 100644
|
| --- a/content/renderer/renderer_webkitplatformsupport_impl.cc
|
| +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc
|
| @@ -610,14 +610,53 @@ size_t RendererWebKitPlatformSupportImpl::audioHardwareBufferSize() {
|
|
|
| WebAudioDevice*
|
| RendererWebKitPlatformSupportImpl::createAudioDevice(
|
| - size_t buffer_size,
|
| - unsigned channels,
|
| - double sample_rate,
|
| + size_t bufferSize,
|
| + unsigned numberOfChannels,
|
| + double sampleRate,
|
| WebAudioDevice::RenderCallback* callback) {
|
| - return new RendererWebAudioDeviceImpl(buffer_size,
|
| - channels,
|
| - sample_rate,
|
| - callback);
|
| + ChannelLayout layout = CHANNEL_LAYOUT_UNSUPPORTED;
|
| +
|
| + // The |numberOfChannels| does not exactly identify the channel layout of the
|
| + // device. The switch statement below assigns a best guess to the channel
|
| + // layout based on number of channels.
|
| + // TODO(crogers): WebKit should give the channel layout instead of the hard
|
| + // channel count.
|
| + switch (numberOfChannels) {
|
| + case 1:
|
| + layout = CHANNEL_LAYOUT_MONO;
|
| + break;
|
| + case 2:
|
| + layout = CHANNEL_LAYOUT_STEREO;
|
| + break;
|
| + case 3:
|
| + layout = CHANNEL_LAYOUT_2_1;
|
| + break;
|
| + case 4:
|
| + layout = CHANNEL_LAYOUT_4_0;
|
| + break;
|
| + case 5:
|
| + layout = CHANNEL_LAYOUT_5_0;
|
| + break;
|
| + case 6:
|
| + layout = CHANNEL_LAYOUT_5_1;
|
| + break;
|
| + case 7:
|
| + layout = CHANNEL_LAYOUT_7_0;
|
| + break;
|
| + case 8:
|
| + layout = CHANNEL_LAYOUT_7_1;
|
| + break;
|
| + default:
|
| + layout = CHANNEL_LAYOUT_STEREO;
|
| + }
|
| +
|
| + AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
|
| + layout,
|
| + static_cast<int>(sampleRate),
|
| + 16,
|
| + bufferSize);
|
| +
|
| + return new RendererWebAudioDeviceImpl(params, callback);
|
| }
|
|
|
| //------------------------------------------------------------------------------
|
|
|