From 8189075377aedb5d879b4f44657bc4b27173de11 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Wed, 9 Feb 2011 13:35:02 -0800 Subject: Fix issue 3436738. The problem is that the AudioPolicyManager refreshes the device attached to the hardware output stream every time another output stops (in this case A2DP output). As there is no active stream on the HW output, the selected device is 0. As the shutter sound is short and there is some additional delay to setup the A2DP output, the sound is not yet out of the AudioFlinger mixer when the device is set to 0. On Crespo, device 0 is a valid audio path (means audio off) which is not the case on other platforms and therefore the output is disabled while the shutter sound is actually playing. The fix consists in ignoring requests to set the output device to 0 in the audio HAL. Change-Id: I7366e359a7d3a0f8207e7a5c879ced9078224002 --- libaudio/AudioHardware.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'libaudio') diff --git a/libaudio/AudioHardware.cpp b/libaudio/AudioHardware.cpp index 99c38fa..45f0a2d 100644 --- a/libaudio/AudioHardware.cpp +++ b/libaudio/AudioHardware.cpp @@ -1241,16 +1241,18 @@ status_t AudioHardware::AudioStreamOutALSA::setParameters(const String8& keyValu if (param.getInt(String8(AudioParameter::keyRouting), device) == NO_ERROR) { - AutoMutex hwLock(mHardware->lock()); + if (device != 0) { + AutoMutex hwLock(mHardware->lock()); - if (mDevices != (uint32_t)device) { - mDevices = (uint32_t)device; - if (mHardware->mode() != AudioSystem::MODE_IN_CALL) { - doStandby_l(); + if (mDevices != (uint32_t)device) { + mDevices = (uint32_t)device; + if (mHardware->mode() != AudioSystem::MODE_IN_CALL) { + doStandby_l(); + } + } + if (mHardware->mode() == AudioSystem::MODE_IN_CALL) { + mHardware->setIncallPath_l(device); } - } - if (mHardware->mode() == AudioSystem::MODE_IN_CALL) { - mHardware->setIncallPath_l(device); } param.remove(String8(AudioParameter::keyRouting)); } -- cgit v1.1