hal: update handling voice call driving output
For device switch from USB headset to speaker or vice-versa,
it is not required to completely tear down the call and restart
on the new device.
Bug: 17573788
Change-Id: I5ccdc225e19a7036dd8c6a028f69a505c9a3634d
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 3c82a85..91df098 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1340,15 +1340,10 @@
if ((adev->mode == AUDIO_MODE_IN_CALL) &&
output_drives_call(adev, out)) {
-
- if (adev->current_call_output != NULL &&
- adev->current_call_output != out) {
- voice_stop_call(adev);
- }
- if (!voice_is_in_call(adev)) {
- adev->current_call_output = out;
+ adev->current_call_output = out;
+ if (!voice_is_in_call(adev))
ret = voice_start_call(adev);
- } else
+ else
voice_update_devices_for_all_voice_usecases(adev);
}
}
@@ -2125,6 +2120,10 @@
if (out->compr_config.codec != NULL)
free(out->compr_config.codec);
}
+
+ if (adev->voice_tx_output == out)
+ adev->voice_tx_output = NULL;
+
pthread_cond_destroy(&out->cond);
pthread_mutex_destroy(&out->lock);
free(stream);
diff --git a/hal/voice.c b/hal/voice.c
index 988be56..669484c 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -462,6 +462,7 @@
if (usecase->type == VOICE_CALL) {
ALOGV("%s: updating device for usecase:%s", __func__,
use_case_table[usecase->id]);
+ usecase->stream.out = adev->current_call_output;
select_devices(adev, usecase->id);
}
}