From 78a7609d251802da4db864dbbee37967be84514f Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Fri, 16 Mar 2012 18:59:28 -0700 Subject: audio: fix audio drop when speaker is selected When changing audio path to speaker while playback is active, several hundred ms of audio are dropped. This is mostly noticeable when a ringtone starts playing. This change is a workaround forcing the output in standby when speaker is selected. The root cause must still be indentified and fixed. Change-Id: Idef8dc1cdbf2da499a414d0b60244f91ef66e73b --- audio/audio_hw.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index bbd849a..850a1b1 100755 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -1415,12 +1415,24 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) } /* force standby if moving to/from HDMI/SPDIF or if the output * device changes when in HDMI/SPDIF mode */ + + /* FIXME workaround for audio being dropped when switching path without forcing standby + * (several hundred ms of audio can be lost: e.g beginning of a ringtone. We must understand + * the root cause in audio HAL, driver or ABE. if (((val & AUDIO_DEVICE_OUT_AUX_DIGITAL) ^ (adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL)) || ((val & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) ^ (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)) || (adev->devices & (AUDIO_DEVICE_OUT_AUX_DIGITAL | AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET))) + */ + if (((val & AUDIO_DEVICE_OUT_AUX_DIGITAL) ^ + (adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL)) || + ((val & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) ^ + (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)) || + (adev->devices & (AUDIO_DEVICE_OUT_AUX_DIGITAL | + AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)) || + (val == AUDIO_DEVICE_OUT_SPEAKER)) do_output_standby(out); } adev->devices &= ~AUDIO_DEVICE_OUT_ALL; -- cgit v1.1