diff options
author | henrika@chromium.org <henrika@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-17 11:58:38 +0000 |
---|---|---|
committer | henrika@chromium.org <henrika@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-17 11:58:38 +0000 |
commit | 6effee11459345a7e1e396fdb5990aded79cba99 (patch) | |
tree | a7c288a7d5e3f42a066235b2641456bc41eeace8 /media | |
parent | a99442bd84c6d95378f229730f53300c2e70bed1 (diff) | |
download | chromium_src-6effee11459345a7e1e396fdb5990aded79cba99.zip chromium_src-6effee11459345a7e1e396fdb5990aded79cba99.tar.gz chromium_src-6effee11459345a7e1e396fdb5990aded79cba99.tar.bz2 |
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
Diffstat (limited to 'media')
-rw-r--r-- | media/audio/win/audio_manager_win.cc | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/media/audio/win/audio_manager_win.cc b/media/audio/win/audio_manager_win.cc index 2fe74d9..38e1c60 100644 --- a/media/audio/win/audio_manager_win.cc +++ b/media/audio/win/audio_manager_win.cc @@ -367,6 +367,8 @@ AudioParameters AudioManagerWin::GetPreferredOutputStreamParameters( // which corresponds to an output delay of ~5.33ms. sample_rate = 48000; buffer_size = 256; + if (input_params.IsValid()) + channel_layout = input_params.channel_layout(); } else if (!use_input_params) { // Hardware sample-rate on Windows can be configured, so we must query. // TODO(henrika): improve possibility to specify an audio endpoint. @@ -390,14 +392,21 @@ AudioParameters AudioManagerWin::GetPreferredOutputStreamParameters( } if (input_params.IsValid()) { - if (CoreAudioUtil::IsSupported() && - CoreAudioUtil::IsChannelLayoutSupported(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 << ")"; + if (CoreAudioUtil::IsSupported()) { + // Check if it is possible to open up at the specified input channel + // layout but avoid checking if the specified layout is the same as the + // hardware (preferred) layout. We do this extra check to avoid the + // CoreAudioUtil::IsChannelLayoutSupported() overhead in most cases. + if (input_params.channel_layout() != channel_layout) { + if (CoreAudioUtil::IsChannelLayoutSupported( + 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(); if (use_input_params) { |