summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authordalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-08 21:43:42 +0000
committerdalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-08 21:43:42 +0000
commit1d359d78320edfb29f109405238ead030b480248 (patch)
tree278c6a36e12156635013f897be9790e45572d905 /media
parent4c335a291deeecc47ca7d1ec9e9087ac5804c262 (diff)
downloadchromium_src-1d359d78320edfb29f109405238ead030b480248.zip
chromium_src-1d359d78320edfb29f109405238ead030b480248.tar.gz
chromium_src-1d359d78320edfb29f109405238ead030b480248.tar.bz2
Fix support for channel layouts other than the hardware layout.
When a channel layout reported as supported was passed into the WASAPI driver, it would still check it against the preferred parameters and fail out. Doing so caused an Open() failure which leads to WaveOut fallback in AudioOutputResampler! I've modified the check to ignore channel counts when checking the parameter validity against preferred params. If the channel counts aren't supported failure will still happen in Open() due to the IsFormatSupported() check failing out. BUG=227043 TEST=latency numbers return to normal R=henrika@chromium.org Review URL: https://codereview.chromium.org/14828007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/audio/win/audio_low_latency_output_win.cc24
-rw-r--r--media/audio/win/audio_low_latency_output_win.h4
2 files changed, 14 insertions, 14 deletions
diff --git a/media/audio/win/audio_low_latency_output_win.cc b/media/audio/win/audio_low_latency_output_win.cc
index a9addac..8a909d0 100644
--- a/media/audio/win/audio_low_latency_output_win.cc
+++ b/media/audio/win/audio_low_latency_output_win.cc
@@ -46,11 +46,11 @@ static ChannelConfig GetChannelConfig() {
// Note that bits_per_sample() is excluded from this comparison since Core
// Audio can deal with most bit depths. As an example, if the native/mixing
// bit depth is 32 bits (default), opening at 16 or 24 still works fine and
-// the audio engine will do the required conversion for us.
-static bool CompareAudioParametersNoBitDepth(const media::AudioParameters& a,
- const media::AudioParameters& b) {
+// the audio engine will do the required conversion for us. Channel count is
+// excluded since Open() will fail anyways and it doesn't impact buffering.
+static bool CompareAudioParametersNoBitDepthOrChannels(
+ const media::AudioParameters& a, const media::AudioParameters& b) {
return (a.format() == b.format() &&
- a.channels() == b.channels() &&
a.sample_rate() == b.sample_rate() &&
a.frames_per_buffer() == b.frames_per_buffer());
}
@@ -124,7 +124,7 @@ WASAPIAudioOutputStream::WASAPIAudioOutputStream(AudioManagerWin* manager,
: creating_thread_id_(base::PlatformThread::CurrentId()),
manager_(manager),
opened_(false),
- audio_parmeters_are_valid_(false),
+ audio_parameters_are_valid_(false),
volume_(1.0),
endpoint_buffer_size_frames_(0),
device_role_(device_role),
@@ -138,15 +138,15 @@ WASAPIAudioOutputStream::WASAPIAudioOutputStream(AudioManagerWin* manager,
<< "Core Audio (WASAPI) EXCLUSIVE MODE is enabled.";
if (share_mode_ == AUDCLNT_SHAREMODE_SHARED) {
- // Verify that the input audio parameters are identical (bit depth is
- // excluded) to the preferred (native) audio parameters. Open() will fail
- // if this is not the case.
+ // Verify that the input audio parameters are identical (bit depth and
+ // channel count are excluded) to the preferred (native) audio parameters.
+ // Open() will fail if this is not the case.
AudioParameters preferred_params;
HRESULT hr = CoreAudioUtil::GetPreferredAudioParameters(
eRender, device_role, &preferred_params);
- audio_parmeters_are_valid_ = SUCCEEDED(hr) &&
- CompareAudioParametersNoBitDepth(params, preferred_params);
- LOG_IF(WARNING, !audio_parmeters_are_valid_)
+ audio_parameters_are_valid_ = SUCCEEDED(hr) &&
+ CompareAudioParametersNoBitDepthOrChannels(params, preferred_params);
+ LOG_IF(WARNING, !audio_parameters_are_valid_)
<< "Input and preferred parameters are not identical.";
}
@@ -207,7 +207,7 @@ bool WASAPIAudioOutputStream::Open() {
// Audio parameters must be identical to the preferred set of parameters
// if shared mode (default) is utilized.
if (share_mode_ == AUDCLNT_SHAREMODE_SHARED) {
- if (!audio_parmeters_are_valid_) {
+ if (!audio_parameters_are_valid_) {
LOG(ERROR) << "Audio parameters are not valid.";
return false;
}
diff --git a/media/audio/win/audio_low_latency_output_win.h b/media/audio/win/audio_low_latency_output_win.h
index 116b92f..b0e990b 100644
--- a/media/audio/win/audio_low_latency_output_win.h
+++ b/media/audio/win/audio_low_latency_output_win.h
@@ -199,8 +199,8 @@ class MEDIA_EXPORT WASAPIAudioOutputStream :
// We check if the input audio parameters are identical (bit depth is
// excluded) to the preferred (native) audio parameters during construction.
- // Open() will fail if |audio_parmeters_are_valid_| is false.
- bool audio_parmeters_are_valid_;
+ // Open() will fail if |audio_parameters_are_valid_| is false.
+ bool audio_parameters_are_valid_;
// Volume level from 0 to 1.
float volume_;