Merge "audio: Enhance latency and tuning in voice call with hearing aid"

This commit is contained in:
qctecmdr 2019-05-07 03:28:07 -07:00 committed by Gerrit - the friendly Code Review server
commit 127fbdb8e9
3 changed files with 33 additions and 3 deletions

View File

@ -2258,7 +2258,8 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
(usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND)) || (usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND)) ||
((vc_usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) && ((vc_usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) &&
(usecase->devices & AUDIO_DEVICE_IN_ALL_CODEC_BACKEND)) || (usecase->devices & AUDIO_DEVICE_IN_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; in_snd_device = vc_usecase->in_snd_device;
out_snd_device = vc_usecase->out_snd_device; out_snd_device = vc_usecase->out_snd_device;
} }
@ -2335,6 +2336,10 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
platform_set_echo_reference(adev, false, AUDIO_DEVICE_NONE); platform_set_echo_reference(adev, false, AUDIO_DEVICE_NONE);
} else if (usecase->id == USECASE_AUDIO_RECORD_AFE_PROXY) { } else if (usecase->id == USECASE_AUDIO_RECORD_AFE_PROXY) {
out_device = AUDIO_DEVICE_OUT_TELEPHONY_TX; out_device = AUDIO_DEVICE_OUT_TELEPHONY_TX;
} 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, out_device); in_snd_device = platform_get_input_snd_device(adev->platform, out_device);
} }
@ -3186,13 +3191,19 @@ static int stop_output_stream(struct stream_out *out)
ALOGE("%s: audio_extn_ip_hdlr_intf_close failed %d",__func__, ret); ALOGE("%s: audio_extn_ip_hdlr_intf_close failed %d",__func__, ret);
} }
/* 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 || if (has_voip_usecase ||
out->devices & AUDIO_DEVICE_OUT_SPEAKER_SAFE) { out->devices & AUDIO_DEVICE_OUT_SPEAKER_SAFE) {
struct listnode *node; struct listnode *node;
struct audio_usecase *usecase; struct audio_usecase *usecase;
list_for_each(node, &adev->usecase_list) { list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_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; continue;
ALOGD("%s: select_devices at usecase(%d: %s) after removing the usecase(%d: %s)", ALOGD("%s: select_devices at usecase(%d: %s) after removing the usecase(%d: %s)",

View File

@ -559,6 +559,7 @@ static const char * const device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_OUT_SPEAKER_WSA_AND_BT_SCO] = "wsa-speaker-and-bt-sco", [SND_DEVICE_OUT_SPEAKER_WSA_AND_BT_SCO] = "wsa-speaker-and-bt-sco",
[SND_DEVICE_OUT_SPEAKER_WSA_AND_BT_SCO_WB] = "wsa-speaker-and-bt-sco-wb", [SND_DEVICE_OUT_SPEAKER_WSA_AND_BT_SCO_WB] = "wsa-speaker-and-bt-sco-wb",
[SND_DEVICE_OUT_SPEAKER_WSA_AND_BT_SCO_SWB] = "wsa-speaker-and-bt-sco-wb", [SND_DEVICE_OUT_SPEAKER_WSA_AND_BT_SCO_SWB] = "wsa-speaker-and-bt-sco-wb",
[SND_DEVICE_OUT_VOICE_HEARING_AID] = "hearing-aid",
/* Capture sound devices */ /* Capture sound devices */
[SND_DEVICE_IN_HANDSET_MIC] = "handset-mic", [SND_DEVICE_IN_HANDSET_MIC] = "handset-mic",
@ -690,6 +691,7 @@ static const char * const device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_OUT_VOIP_HANDSET] = "voip-handset", [SND_DEVICE_OUT_VOIP_HANDSET] = "voip-handset",
[SND_DEVICE_OUT_VOIP_SPEAKER] = "voip-speaker", [SND_DEVICE_OUT_VOIP_SPEAKER] = "voip-speaker",
[SND_DEVICE_OUT_VOIP_HEADPHONES] = "voip-headphones", [SND_DEVICE_OUT_VOIP_HEADPHONES] = "voip-headphones",
[SND_DEVICE_IN_VOICE_HEARING_AID] = "hearing-aid-mic",
}; };
// Platform specific backend bit width table // Platform specific backend bit width table
@ -810,6 +812,7 @@ static int acdb_device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_OUT_VOICE_SPEAKER_STEREO_PROTECTED] = 124, [SND_DEVICE_OUT_VOICE_SPEAKER_STEREO_PROTECTED] = 124,
[SND_DEVICE_OUT_SPEAKER_PROTECTED_RAS] = 134, [SND_DEVICE_OUT_SPEAKER_PROTECTED_RAS] = 134,
[SND_DEVICE_OUT_SPEAKER_PROTECTED_VBAT_RAS] = 134, [SND_DEVICE_OUT_SPEAKER_PROTECTED_VBAT_RAS] = 134,
[SND_DEVICE_OUT_VOICE_HEARING_AID] = 45,
[SND_DEVICE_IN_HANDSET_MIC] = 4, [SND_DEVICE_IN_HANDSET_MIC] = 4,
[SND_DEVICE_IN_HANDSET_MIC_SB] = 163, [SND_DEVICE_IN_HANDSET_MIC_SB] = 163,
[SND_DEVICE_IN_HANDSET_MIC_EXTERNAL] = 4, [SND_DEVICE_IN_HANDSET_MIC_EXTERNAL] = 4,
@ -936,6 +939,7 @@ static int acdb_device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_IN_CAMCORDER_SELFIE_LANDSCAPE] = 4, [SND_DEVICE_IN_CAMCORDER_SELFIE_LANDSCAPE] = 4,
[SND_DEVICE_IN_CAMCORDER_SELFIE_INVERT_LANDSCAPE] = 4, [SND_DEVICE_IN_CAMCORDER_SELFIE_INVERT_LANDSCAPE] = 4,
[SND_DEVICE_IN_CAMCORDER_SELFIE_PORTRAIT] = 4, [SND_DEVICE_IN_CAMCORDER_SELFIE_PORTRAIT] = 4,
[SND_DEVICE_IN_VOICE_HEARING_AID] = 44,
}; };
struct name_to_index { struct name_to_index {
@ -1030,6 +1034,7 @@ static struct name_to_index snd_device_name_index[SND_DEVICE_MAX] = {
{TO_NAME_INDEX(SND_DEVICE_OUT_VOIP_HANDSET)}, {TO_NAME_INDEX(SND_DEVICE_OUT_VOIP_HANDSET)},
{TO_NAME_INDEX(SND_DEVICE_OUT_VOIP_SPEAKER)}, {TO_NAME_INDEX(SND_DEVICE_OUT_VOIP_SPEAKER)},
{TO_NAME_INDEX(SND_DEVICE_OUT_VOIP_HEADPHONES)}, {TO_NAME_INDEX(SND_DEVICE_OUT_VOIP_HEADPHONES)},
{TO_NAME_INDEX(SND_DEVICE_OUT_VOICE_HEARING_AID)},
{TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_MIC)}, {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_MIC)},
{TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_MIC_SB)}, {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_MIC_SB)},
{TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_MIC_EXTERNAL)}, {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_MIC_EXTERNAL)},
@ -1126,6 +1131,7 @@ static struct name_to_index snd_device_name_index[SND_DEVICE_MAX] = {
{TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_QMIC)}, {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_QMIC)},
{TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_QMIC_AEC)}, {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_QMIC_AEC)},
{TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_QMIC_AEC)}, {TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_QMIC_AEC)},
{TO_NAME_INDEX(SND_DEVICE_IN_VOICE_HEARING_AID)},
{TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_QMIC_NS)}, {TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_QMIC_NS)},
{TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_QMIC_AEC_NS)}, {TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_QMIC_AEC_NS)},
{TO_NAME_INDEX(SND_DEVICE_IN_VOICE_REC_QMIC_FLUENCE)}, {TO_NAME_INDEX(SND_DEVICE_IN_VOICE_REC_QMIC_FLUENCE)},
@ -2046,6 +2052,7 @@ static void set_platform_defaults(struct platform_data * my_data)
backend_tag_table[SND_DEVICE_OUT_VOICE_SPEAKER_STEREO_AND_VOICE_HEADPHONES] = strdup("speaker-and-headphones"); backend_tag_table[SND_DEVICE_OUT_VOICE_SPEAKER_STEREO_AND_VOICE_HEADPHONES] = strdup("speaker-and-headphones");
backend_tag_table[SND_DEVICE_OUT_VOICE_SPEAKER_STEREO_AND_VOICE_ANC_HEADSET] = strdup("speaker-and-headphones"); backend_tag_table[SND_DEVICE_OUT_VOICE_SPEAKER_STEREO_AND_VOICE_ANC_HEADSET] = strdup("speaker-and-headphones");
backend_tag_table[SND_DEVICE_OUT_VOICE_SPEAKER_STEREO_AND_VOICE_ANC_FB_HEADSET] = strdup("speaker-and-headphones"); backend_tag_table[SND_DEVICE_OUT_VOICE_SPEAKER_STEREO_AND_VOICE_ANC_FB_HEADSET] = strdup("speaker-and-headphones");
backend_tag_table[SND_DEVICE_OUT_VOICE_HEARING_AID] = strdup("hearing-aid");
hw_interface_table[SND_DEVICE_OUT_HANDSET] = strdup("SLIMBUS_0_RX"); hw_interface_table[SND_DEVICE_OUT_HANDSET] = strdup("SLIMBUS_0_RX");
hw_interface_table[SND_DEVICE_OUT_SPEAKER] = strdup("SLIMBUS_0_RX"); hw_interface_table[SND_DEVICE_OUT_SPEAKER] = strdup("SLIMBUS_0_RX");
@ -2131,6 +2138,10 @@ static void set_platform_defaults(struct platform_data * my_data)
hw_interface_table[SND_DEVICE_OUT_SPEAKER_WSA] = strdup("SLIMBUS_0_RX"); hw_interface_table[SND_DEVICE_OUT_SPEAKER_WSA] = strdup("SLIMBUS_0_RX");
hw_interface_table[SND_DEVICE_OUT_VOICE_SPEAKER_WSA] = strdup("SLIMBUS_0_RX"); hw_interface_table[SND_DEVICE_OUT_VOICE_SPEAKER_WSA] = strdup("SLIMBUS_0_RX");
hw_interface_table[SND_DEVICE_OUT_VOICE_SPEAKER_2_WSA] = strdup("SLIMBUS_0_RX"); hw_interface_table[SND_DEVICE_OUT_VOICE_SPEAKER_2_WSA] = strdup("SLIMBUS_0_RX");
/* So far, primary hal doesn't support hearing aid device.
Need snd_device to route voice call and use specific acdb tuning.
Also, BT_RX is a virtual port to indicate bluetooth hearing aid. */
hw_interface_table[SND_DEVICE_OUT_VOICE_HEARING_AID] = strdup("BT_RX"),
hw_interface_table[SND_DEVICE_IN_HANDSET_MIC] = strdup("SLIMBUS_0_TX"); hw_interface_table[SND_DEVICE_IN_HANDSET_MIC] = strdup("SLIMBUS_0_TX");
hw_interface_table[SND_DEVICE_IN_HANDSET_MIC_SB] = strdup("SLIMBUS_0_TX"); hw_interface_table[SND_DEVICE_IN_HANDSET_MIC_SB] = strdup("SLIMBUS_0_TX");
hw_interface_table[SND_DEVICE_IN_HANDSET_MIC_EXTERNAL] = strdup("SLIMBUS_0_TX"); hw_interface_table[SND_DEVICE_IN_HANDSET_MIC_EXTERNAL] = strdup("SLIMBUS_0_TX");
@ -2256,6 +2267,7 @@ static void set_platform_defaults(struct platform_data * my_data)
hw_interface_table[SND_DEVICE_IN_CAMCORDER_SELFIE_LANDSCAPE] = strdup("SLIMBUS_0_TX"); hw_interface_table[SND_DEVICE_IN_CAMCORDER_SELFIE_LANDSCAPE] = strdup("SLIMBUS_0_TX");
hw_interface_table[SND_DEVICE_IN_CAMCORDER_SELFIE_INVERT_LANDSCAPE] = strdup("SLIMBUS_0_TX"); hw_interface_table[SND_DEVICE_IN_CAMCORDER_SELFIE_INVERT_LANDSCAPE] = strdup("SLIMBUS_0_TX");
hw_interface_table[SND_DEVICE_IN_CAMCORDER_SELFIE_PORTRAIT] = strdup("SLIMBUS_0_TX"); hw_interface_table[SND_DEVICE_IN_CAMCORDER_SELFIE_PORTRAIT] = strdup("SLIMBUS_0_TX");
hw_interface_table[SND_DEVICE_IN_VOICE_HEARING_AID] = strdup("SLIMBUS_0_TX");
my_data->max_mic_count = PLATFORM_DEFAULT_MIC_COUNT; my_data->max_mic_count = PLATFORM_DEFAULT_MIC_COUNT;
/*remove ALAC & APE from DSP decoder list based on software decoder availability*/ /*remove ALAC & APE from DSP decoder list based on software decoder availability*/
@ -5464,8 +5476,11 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o
snd_device = SND_DEVICE_OUT_ANC_HANDSET; snd_device = SND_DEVICE_OUT_ANC_HANDSET;
else else
snd_device = SND_DEVICE_OUT_VOICE_HANDSET; snd_device = SND_DEVICE_OUT_VOICE_HANDSET;
} else if (devices & AUDIO_DEVICE_OUT_TELEPHONY_TX) } else if (devices & AUDIO_DEVICE_OUT_TELEPHONY_TX) {
snd_device = SND_DEVICE_OUT_VOICE_TX; snd_device = SND_DEVICE_OUT_VOICE_TX;
} else if (devices & AUDIO_DEVICE_OUT_HEARING_AID) {
snd_device = SND_DEVICE_OUT_VOICE_HEARING_AID;
}
if (snd_device != SND_DEVICE_NONE) { if (snd_device != SND_DEVICE_NONE) {
goto exit; goto exit;
@ -6001,6 +6016,8 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
} else { } else {
snd_device = SND_DEVICE_IN_HANDSET_MIC; snd_device = SND_DEVICE_IN_HANDSET_MIC;
} }
} else if (out_device & AUDIO_DEVICE_OUT_HEARING_AID) {
snd_device = SND_DEVICE_IN_VOICE_HEARING_AID;
} }
} else if (my_data->use_generic_handset == true && // system prop is enabled } else if (my_data->use_generic_handset == true && // system prop is enabled
(my_data->source_mic_type & SOURCE_QUAD_MIC) && // AND 4mic is available (my_data->source_mic_type & SOURCE_QUAD_MIC) && // AND 4mic is available

View File

@ -173,6 +173,7 @@ enum {
SND_DEVICE_OUT_VOICE_SPEAKER_STEREO_AND_VOICE_HEADPHONES, SND_DEVICE_OUT_VOICE_SPEAKER_STEREO_AND_VOICE_HEADPHONES,
SND_DEVICE_OUT_VOICE_SPEAKER_STEREO_AND_VOICE_ANC_HEADSET, SND_DEVICE_OUT_VOICE_SPEAKER_STEREO_AND_VOICE_ANC_HEADSET,
SND_DEVICE_OUT_VOICE_SPEAKER_STEREO_AND_VOICE_ANC_FB_HEADSET, SND_DEVICE_OUT_VOICE_SPEAKER_STEREO_AND_VOICE_ANC_FB_HEADSET,
SND_DEVICE_OUT_VOICE_HEARING_AID,
SND_DEVICE_OUT_END, SND_DEVICE_OUT_END,
/* /*
@ -308,6 +309,7 @@ enum {
SND_DEVICE_IN_CAMCORDER_SELFIE_LANDSCAPE, SND_DEVICE_IN_CAMCORDER_SELFIE_LANDSCAPE,
SND_DEVICE_IN_CAMCORDER_SELFIE_INVERT_LANDSCAPE, SND_DEVICE_IN_CAMCORDER_SELFIE_INVERT_LANDSCAPE,
SND_DEVICE_IN_CAMCORDER_SELFIE_PORTRAIT, SND_DEVICE_IN_CAMCORDER_SELFIE_PORTRAIT,
SND_DEVICE_IN_VOICE_HEARING_AID,
SND_DEVICE_IN_END, SND_DEVICE_IN_END,
SND_DEVICE_MAX = SND_DEVICE_IN_END, SND_DEVICE_MAX = SND_DEVICE_IN_END,