diff options
author | Simon Wilson <simonwilson@google.com> | 2011-09-08 17:40:17 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-09-08 17:40:17 -0700 |
commit | e221e72d566fffe5ac12785c72ebd9325bafba43 (patch) | |
tree | 538f49afe79ec106a6b5ae2645568478c6b2e6e7 /audio | |
parent | 3bcace38aa5a7ba27f13eddae47c1aabeded3af9 (diff) | |
parent | df84bfdd5f778122a8154a9de015911b75a4250c (diff) | |
download | device_samsung_tuna-e221e72d566fffe5ac12785c72ebd9325bafba43.zip device_samsung_tuna-e221e72d566fffe5ac12785c72ebd9325bafba43.tar.gz device_samsung_tuna-e221e72d566fffe5ac12785c72ebd9325bafba43.tar.bz2 |
Merge "audio: don't put output in standby when changing route"
Diffstat (limited to 'audio')
-rw-r--r-- | audio/audio_hw.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 1ecf92a..df90985 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -661,14 +661,7 @@ static void set_input_volumes(struct tuna_audio_device *adev, int main_mic_on, static void force_all_standby(struct tuna_audio_device *adev) { struct tuna_stream_in *in; - struct tuna_stream_out *out; - if (adev->active_output) { - out = adev->active_output; - pthread_mutex_lock(&out->lock); - do_output_standby(out); - pthread_mutex_unlock(&out->lock); - } if (adev->active_input) { in = adev->active_input; pthread_mutex_lock(&in->lock); @@ -1146,18 +1139,16 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) pthread_mutex_lock(&out->lock); if ((out->device != val) && (val != 0)) { out->device = val; - if (adev->mode == AUDIO_MODE_IN_CALL) { - adev->devices &= ~AUDIO_DEVICE_OUT_ALL; - adev->devices |= out->device; - select_output_device(adev); - } else if (out == adev->active_output) { - do_output_standby(out); + if (out == adev->active_output) { /* a change in output device may change the microphone selection */ if (adev->active_input && adev->active_input->source == AUDIO_SOURCE_VOICE_COMMUNICATION) { force_input_standby = true; } } + adev->devices &= ~AUDIO_DEVICE_OUT_ALL; + adev->devices |= out->device; + select_output_device(adev); } pthread_mutex_unlock(&out->lock); if (force_input_standby) { @@ -1956,6 +1947,14 @@ static int adev_open_output_stream(struct audio_hw_device *dev, out->dev = ladev; out->standby = 1; + /* FIXME: when we support multiple output devices, we will want to + * do the following: + * adev->devices &= ~AUDIO_DEVICE_OUT_ALL; + * adev->devices |= out->device; + * select_output_device(adev); + * This is because out_set_parameters() with a route is not + * guaranteed to be called after an output stream is opened. */ + *format = out_get_format(&out->stream.common); *channels = out_get_channels(&out->stream.common); *sample_rate = out_get_sample_rate(&out->stream.common); |