audio: Enhance latency and tuning in voice call with hearing aid
1. Reduce microphone latency in voice call
2. Use specific acdb tuning
Bug: 120869034
Test: manual audio test
Change-Id: Ifabd1ce2cce5bb4285cc33cd792070c0c3b20f1a
Signed-off-by: juyuchen <juyuchen@google.com>
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 657a627..618381a 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1510,7 +1510,8 @@
get_voice_usecase_id_from_list(adev));
if ((vc_usecase != NULL) &&
((vc_usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) ||
- (usecase->devices == AUDIO_DEVICE_IN_VOICE_CALL))) {
+ (vc_usecase->devices == AUDIO_DEVICE_OUT_HEARING_AID) ||
+ (usecase->devices == AUDIO_DEVICE_IN_VOICE_CALL))) {
in_snd_device = vc_usecase->in_snd_device;
out_snd_device = vc_usecase->out_snd_device;
}
@@ -1556,8 +1557,13 @@
out_device = AUDIO_DEVICE_OUT_TELEPHONY_TX;
} else if (voip_usecase) {
out_device = voip_usecase->stream.out->devices;
- } else if (adev->primary_output) {
+ } else if (adev->primary_output &&
+ !adev->primary_output->standby) {
out_device = adev->primary_output->devices;
+ } else {
+ /* forcing speaker o/p device to get matching i/p pair
+ in case o/p is not routed from same primary HAL */
+ out_device = AUDIO_DEVICE_OUT_SPEAKER;
}
}
in_snd_device = platform_get_input_snd_device(adev->platform,
@@ -2213,14 +2219,19 @@
}
ret = 0;
}
-
+ /* 1) media + voip output routing to handset must route media back to
+ speaker when voip stops.
+ 2) trigger voip input to reroute when voip output changes to
+ hearing aid. */
if (has_voip_usecase ||
out->devices & AUDIO_DEVICE_OUT_SPEAKER_SAFE) {
struct listnode *node;
struct audio_usecase *usecase;
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
- if (usecase->type == PCM_CAPTURE || usecase == uc_info)
+ if ((usecase->type == PCM_CAPTURE &&
+ usecase->id != USECASE_AUDIO_RECORD_VOIP)
+ || usecase == uc_info)
continue;
ALOGD("%s: select_devices at usecase(%d: %s) after removing the usecase(%d: %s)",