From 233c249b7be2e836f17155523e2779dbbff6529c Mon Sep 17 00:00:00 2001 From: Simon Wilson Date: Tue, 12 Jul 2011 11:24:24 -0700 Subject: audio: put pcm into standby before changing output device This avoids the high-pitched whine when changing the route from speaker to headset by ensuring that no bytes are being transferred through the ABE while the route is altered. It also means the workaround to avoid the kernel panic when exiting standby in out_write() can be removed. Change-Id: I67d391d003bd90892622a212b45a394e2d15ff70 --- audio/audio_hw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 90c7d3f..b431548 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -581,6 +581,7 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) if (ret >= 0) { if (adev->out_device != atoi(value)) { adev->out_device = atoi(value); + out_standby(stream); select_output_device(adev); } } @@ -629,8 +630,6 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, pthread_mutex_lock(&out->lock); if (out->standby) { - /* reset the downlink mixer settings otherwise the ABE panics */ - select_output_device(adev); ret = start_output_stream(out); if (ret == 0) out->standby = 0; -- cgit v1.1