diff options
author | dalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-02 01:14:09 +0000 |
---|---|---|
committer | dalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-02 01:14:09 +0000 |
commit | c1fa754ae0bafc20508962cc6e060e4186a971b7 (patch) | |
tree | d1b0133cb989873a02cfb3ebf31f4825afa0b1dc /media | |
parent | 5cf07a4dcb899268019c36a2a1dcc8a0a2c0d26d (diff) | |
download | chromium_src-c1fa754ae0bafc20508962cc6e060e4186a971b7.zip chromium_src-c1fa754ae0bafc20508962cc6e060e4186a971b7.tar.gz chromium_src-c1fa754ae0bafc20508962cc6e060e4186a971b7.tar.bz2 |
Attempt to workaround junk channel and channel layout values.
Bug reports show a lot of users with junk dwChannelMask values,
yet working audio in other applications. They also note that
this issue appeared recently; likely when we reverted support
for pass-through layouts to fix http://crbug.com/259165.
This fix enables guessing of channel layouts based on the
reported channel count and, if that's still bad, re-enables
support for pass-through layouts.
BUG=169846,309823,311906
TEST=none
R=scherkus@chromium.org
Review URL: https://codereview.chromium.org/54363009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232538 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/audio/win/audio_manager_win.cc | 6 | ||||
-rw-r--r-- | media/audio/win/core_audio_util_win.cc | 10 |
2 files changed, 15 insertions, 1 deletions
diff --git a/media/audio/win/audio_manager_win.cc b/media/audio/win/audio_manager_win.cc index 254fe36..06f9ccb 100644 --- a/media/audio/win/audio_manager_win.cc +++ b/media/audio/win/audio_manager_win.cc @@ -455,8 +455,12 @@ AudioParameters AudioManagerWin::GetPreferredOutputStreamParameters( } if (input_params.IsValid()) { + // If the user has enabled checking supported channel layouts or we don't + // have a valid channel layout yet, try to use the input layout. See bugs + // http://crbug.com/259165 and http://crbug.com/311906 for more details. if (core_audio_supported && - cmd_line->HasSwitch(switches::kTrySupportedChannelLayouts)) { + (cmd_line->HasSwitch(switches::kTrySupportedChannelLayouts) || + channel_layout == CHANNEL_LAYOUT_UNSUPPORTED)) { // 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 diff --git a/media/audio/win/core_audio_util_win.cc b/media/audio/win/core_audio_util_win.cc index 4771460..790b2b1 100644 --- a/media/audio/win/core_audio_util_win.cc +++ b/media/audio/win/core_audio_util_win.cc @@ -623,6 +623,16 @@ HRESULT CoreAudioUtil::GetPreferredAudioParameters( // Convert Microsoft's channel configuration to genric ChannelLayout. ChannelLayout channel_layout = ChannelConfigToChannelLayout(channel_config); + // Some devices don't appear to set a valid channel layout, so guess based on + // the number of channels. See http://crbug.com/311906. + if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) { + VLOG(1) << "Unsupported channel config: " + << std::hex << channel_config + << ". Guessing layout by channel count: " + << std::dec << mix_format.Format.nChannels; + channel_layout = GuessChannelLayout(mix_format.Format.nChannels); + } + // Preferred sample rate. int sample_rate = mix_format.Format.nSamplesPerSec; |