Commit 6effee11 authored by henrika@chromium.org's avatar henrika@chromium.org

Resolves "Huge increase in audio latency on Windows following r192046".

BUG=227043
TEST=content_unittests and mish audio tests in Chrome

Review URL: https://codereview.chromium.org/14244005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194573 0039d316-1c4b-4281-b951-d872f2087c98
parent a99442bd
...@@ -367,6 +367,8 @@ AudioParameters AudioManagerWin::GetPreferredOutputStreamParameters( ...@@ -367,6 +367,8 @@ AudioParameters AudioManagerWin::GetPreferredOutputStreamParameters(
// which corresponds to an output delay of ~5.33ms. // which corresponds to an output delay of ~5.33ms.
sample_rate = 48000; sample_rate = 48000;
buffer_size = 256; buffer_size = 256;
if (input_params.IsValid())
channel_layout = input_params.channel_layout();
} else if (!use_input_params) { } else if (!use_input_params) {
// Hardware sample-rate on Windows can be configured, so we must query. // Hardware sample-rate on Windows can be configured, so we must query.
// TODO(henrika): improve possibility to specify an audio endpoint. // TODO(henrika): improve possibility to specify an audio endpoint.
...@@ -390,14 +392,21 @@ AudioParameters AudioManagerWin::GetPreferredOutputStreamParameters( ...@@ -390,14 +392,21 @@ AudioParameters AudioManagerWin::GetPreferredOutputStreamParameters(
} }
if (input_params.IsValid()) { if (input_params.IsValid()) {
if (CoreAudioUtil::IsSupported() && if (CoreAudioUtil::IsSupported()) {
CoreAudioUtil::IsChannelLayoutSupported(eRender, eConsole, // Check if it is possible to open up at the specified input channel
input_params.channel_layout())) { // layout but avoid checking if the specified layout is the same as the
// Open up using the same channel layout as the source if it is // hardware (preferred) layout. We do this extra check to avoid the
// supported by the hardware. // CoreAudioUtil::IsChannelLayoutSupported() overhead in most cases.
channel_layout = input_params.channel_layout(); if (input_params.channel_layout() != channel_layout) {
VLOG(1) << "Hardware channel layout is not used; using same " if (CoreAudioUtil::IsChannelLayoutSupported(
<< "layout as the source instead (" << channel_layout << ")"; eRender, eConsole, input_params.channel_layout())) {
// Open up using the same channel layout as the source if it is
// supported by the hardware.
channel_layout = input_params.channel_layout();
VLOG(1) << "Hardware channel layout is not used; using same layout"
<< " as the source instead (" << channel_layout << ")";
}
}
} }
input_channels = input_params.input_channels(); input_channels = input_params.input_channels();
if (use_input_params) { if (use_input_params) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment