hal: Fixed incall recording backend ids
During in call recording, input device is same as that of voice use case but the backend used in routing driver is different. Due to mismatch of backend ids, Wrong acdb id and app type are being set in routing driver when adm port is opened. Defined new devices for in call recording and used the new devices to retrive the backend ids. CRs-Fixed: 2183315 Change-Id: I278996185badad640e16f60730176916d81e3626
This commit is contained in:
parent
c491616d16
commit
85d0a59463
|
@ -873,6 +873,25 @@ void audio_extn_utils_update_stream_app_type_cfg_for_usecase(
|
|||
}
|
||||
}
|
||||
|
||||
void audio_extn_btsco_get_sample_rate(int snd_device, int *sample_rate)
|
||||
{
|
||||
switch (snd_device) {
|
||||
case SND_DEVICE_OUT_BT_SCO:
|
||||
case SND_DEVICE_IN_BT_SCO_MIC:
|
||||
case SND_DEVICE_IN_BT_SCO_MIC_NREC:
|
||||
*sample_rate = 8000;
|
||||
break;
|
||||
case SND_DEVICE_OUT_BT_SCO_WB:
|
||||
case SND_DEVICE_IN_BT_SCO_MIC_WB:
|
||||
case SND_DEVICE_IN_BT_SCO_MIC_WB_NREC:
|
||||
*sample_rate = 16000;
|
||||
break;
|
||||
default:
|
||||
ALOGD("%s:Not a BT SCO device, need not update sampling rate\n", __func__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int send_app_type_cfg_for_device(struct audio_device *adev,
|
||||
struct audio_usecase *usecase,
|
||||
int split_snd_device)
|
||||
|
@ -939,8 +958,13 @@ static int send_app_type_cfg_for_device(struct audio_device *adev,
|
|||
goto exit_send_app_type_cfg;
|
||||
}
|
||||
snd_device = platform_get_spkr_prot_snd_device(snd_device);
|
||||
|
||||
acdb_dev_id = platform_get_snd_device_acdb_id(snd_device);
|
||||
if (voice_is_in_call_rec_stream(usecase->stream.in) && usecase->type == PCM_CAPTURE) {
|
||||
snd_device_t voice_device = voice_get_incall_rec_snd_device(usecase->in_snd_device);
|
||||
acdb_dev_id = platform_get_snd_device_acdb_id(voice_device);
|
||||
ALOGV("acdb id for voice call use case %d", acdb_dev_id);
|
||||
} else {
|
||||
acdb_dev_id = platform_get_snd_device_acdb_id(snd_device);
|
||||
}
|
||||
if (acdb_dev_id <= 0) {
|
||||
ALOGE("%s: Couldn't get the acdb dev id", __func__);
|
||||
rc = -EINVAL;
|
||||
|
@ -996,6 +1020,7 @@ static int send_app_type_cfg_for_device(struct audio_device *adev,
|
|||
ALOGI("%s using %d sample rate rate for A2DP CoPP",
|
||||
__func__, usecase->stream.out->app_type_cfg.sample_rate);
|
||||
}
|
||||
audio_extn_btsco_get_sample_rate(snd_device, &usecase->stream.out->app_type_cfg.sample_rate);
|
||||
sample_rate = usecase->stream.out->app_type_cfg.sample_rate;
|
||||
|
||||
/* Interactive streams are supported with only direct app type id.
|
||||
|
@ -1038,6 +1063,11 @@ static int send_app_type_cfg_for_device(struct audio_device *adev,
|
|||
app_type_cfg[len++] = acdb_dev_id;
|
||||
if (usecase->id == USECASE_AUDIO_RECORD_VOIP)
|
||||
usecase->stream.in->app_type_cfg.sample_rate = usecase->stream.in->sample_rate;
|
||||
if (voice_is_in_call_rec_stream(usecase->stream.in)) {
|
||||
audio_extn_btsco_get_sample_rate(usecase->in_snd_device, &usecase->stream.in->app_type_cfg.sample_rate);
|
||||
} else {
|
||||
audio_extn_btsco_get_sample_rate(snd_device, &usecase->stream.in->app_type_cfg.sample_rate);
|
||||
}
|
||||
sample_rate = usecase->stream.in->app_type_cfg.sample_rate;
|
||||
app_type_cfg[len++] = sample_rate;
|
||||
if (snd_device_be_idx > 0)
|
||||
|
@ -1071,6 +1101,7 @@ int audio_extn_utils_send_app_type_cfg(struct audio_device *adev,
|
|||
{
|
||||
int i, num_devices = 0;
|
||||
snd_device_t new_snd_devices[SND_DEVICE_OUT_END] = {0};
|
||||
snd_device_t in_snd_device = usecase->in_snd_device;
|
||||
int rc = 0;
|
||||
|
||||
switch (usecase->type) {
|
||||
|
@ -1089,11 +1120,14 @@ int audio_extn_utils_send_app_type_cfg(struct audio_device *adev,
|
|||
case PCM_CAPTURE:
|
||||
ALOGD("%s: usecase->in_snd_device %s",
|
||||
__func__, platform_get_snd_device_name(usecase->in_snd_device));
|
||||
if (voice_is_in_call_rec_stream(usecase->stream.in)) {
|
||||
in_snd_device = voice_get_incall_rec_backend_device(usecase->stream.in);
|
||||
}
|
||||
/* check for in combo device */
|
||||
if (platform_split_snd_device(adev->platform,
|
||||
usecase->in_snd_device,
|
||||
in_snd_device,
|
||||
&num_devices, new_snd_devices)) {
|
||||
new_snd_devices[0] = usecase->in_snd_device;
|
||||
new_snd_devices[0] = in_snd_device;
|
||||
num_devices = 1;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -567,6 +567,9 @@ static const char * const device_table[SND_DEVICE_MAX] = {
|
|||
[SND_DEVICE_IN_EC_REF_LOOPBACK_MONO] = "ec-ref-loopback-mono",
|
||||
[SND_DEVICE_IN_EC_REF_LOOPBACK_STEREO] = "ec-ref-loopback-stereo",
|
||||
[SND_DEVICE_IN_HANDSET_GENERIC_QMIC] = "quad-mic",
|
||||
[SND_DEVICE_IN_INCALL_REC_RX] = "incall-rec-rx",
|
||||
[SND_DEVICE_IN_INCALL_REC_TX] = "incall-rec-tx",
|
||||
[SND_DEVICE_IN_INCALL_REC_RX_TX] = "incall-rec-rx-tx",
|
||||
};
|
||||
|
||||
// Platform specific backend bit width table
|
||||
|
@ -899,6 +902,9 @@ static struct name_to_index snd_device_name_index[SND_DEVICE_MAX] = {
|
|||
{TO_NAME_INDEX(SND_DEVICE_IN_EC_REF_LOOPBACK_MONO)},
|
||||
{TO_NAME_INDEX(SND_DEVICE_IN_EC_REF_LOOPBACK_STEREO)},
|
||||
{TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_QMIC)},
|
||||
{TO_NAME_INDEX(SND_DEVICE_IN_INCALL_REC_RX)},
|
||||
{TO_NAME_INDEX(SND_DEVICE_IN_INCALL_REC_TX)},
|
||||
{TO_NAME_INDEX(SND_DEVICE_IN_INCALL_REC_RX_TX)},
|
||||
};
|
||||
|
||||
static char * backend_tag_table[SND_DEVICE_MAX] = {0};
|
||||
|
@ -1741,6 +1747,8 @@ static void set_platform_defaults(struct platform_data * my_data)
|
|||
hw_interface_table[SND_DEVICE_IN_UNPROCESSED_QUAD_MIC] = strdup("SLIMBUS_0_TX");
|
||||
hw_interface_table[SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC] = strdup("SLIMBUS_0_TX");
|
||||
hw_interface_table[SND_DEVICE_IN_HANDSET_GENERIC_QMIC] = strdup("SLIMBUS_0_TX");
|
||||
hw_interface_table[SND_DEVICE_IN_INCALL_REC_RX] = strdup("INCALL_RECORD_RX");
|
||||
hw_interface_table[SND_DEVICE_IN_INCALL_REC_TX] = strdup("INCALL_RECORD_TX");
|
||||
|
||||
my_data->max_mic_count = PLATFORM_DEFAULT_MIC_COUNT;
|
||||
/*remove ALAC & APE from DSP decoder list based on software decoder availability*/
|
||||
|
@ -3899,6 +3907,11 @@ int platform_split_snd_device(void *platform,
|
|||
new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
|
||||
new_snd_devices[1] = SND_DEVICE_OUT_BT_A2DP;
|
||||
ret = 0;
|
||||
} else if (SND_DEVICE_IN_INCALL_REC_RX_TX == snd_device) {
|
||||
*num_devices = 2;
|
||||
new_snd_devices[0] = SND_DEVICE_IN_INCALL_REC_RX;
|
||||
new_snd_devices[1] = SND_DEVICE_IN_INCALL_REC_TX;
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
ALOGD("%s: snd_device(%d) num devices(%d) new_snd_devices(%d)", __func__,
|
||||
|
|
|
@ -241,6 +241,9 @@ enum {
|
|||
SND_DEVICE_IN_EC_REF_LOOPBACK_MONO,
|
||||
SND_DEVICE_IN_EC_REF_LOOPBACK_STEREO,
|
||||
SND_DEVICE_IN_HANDSET_GENERIC_QMIC,
|
||||
SND_DEVICE_IN_INCALL_REC_RX,
|
||||
SND_DEVICE_IN_INCALL_REC_TX,
|
||||
SND_DEVICE_IN_INCALL_REC_RX_TX,
|
||||
SND_DEVICE_IN_END,
|
||||
|
||||
SND_DEVICE_MAX = SND_DEVICE_IN_END,
|
||||
|
|
|
@ -553,6 +553,9 @@ static const char * const device_table[SND_DEVICE_MAX] = {
|
|||
[SND_DEVICE_IN_UNPROCESSED_QUAD_MIC] = "unprocessed-quad-mic",
|
||||
[SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC] = "unprocessed-headset-mic",
|
||||
[SND_DEVICE_IN_HANDSET_GENERIC_QMIC] = "quad-mic",
|
||||
[SND_DEVICE_IN_INCALL_REC_RX] = "incall-rec-rx",
|
||||
[SND_DEVICE_IN_INCALL_REC_TX] = "incall-rec-tx",
|
||||
[SND_DEVICE_IN_INCALL_REC_RX_TX] = "incall-rec-rx-tx",
|
||||
};
|
||||
|
||||
// Platform specific backend bit width table
|
||||
|
@ -889,6 +892,9 @@ static struct name_to_index snd_device_name_index[SND_DEVICE_MAX] = {
|
|||
{TO_NAME_INDEX(SND_DEVICE_IN_UNPROCESSED_QUAD_MIC)},
|
||||
{TO_NAME_INDEX(SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC)},
|
||||
{TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_QMIC)},
|
||||
{TO_NAME_INDEX(SND_DEVICE_IN_INCALL_REC_RX)},
|
||||
{TO_NAME_INDEX(SND_DEVICE_IN_INCALL_REC_TX)},
|
||||
{TO_NAME_INDEX(SND_DEVICE_IN_INCALL_REC_RX_TX)},
|
||||
};
|
||||
|
||||
static char * backend_tag_table[SND_DEVICE_MAX] = {0};
|
||||
|
@ -1626,6 +1632,8 @@ static void set_platform_defaults(struct platform_data * my_data)
|
|||
hw_interface_table[SND_DEVICE_IN_UNPROCESSED_QUAD_MIC] = strdup("SLIMBUS_0_TX");
|
||||
hw_interface_table[SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC] = strdup("SLIMBUS_0_TX");
|
||||
hw_interface_table[SND_DEVICE_IN_HANDSET_GENERIC_QMIC] = strdup("SLIMBUS_0_TX");
|
||||
hw_interface_table[SND_DEVICE_IN_INCALL_REC_RX] = strdup("INCALL_RECORD_RX");
|
||||
hw_interface_table[SND_DEVICE_IN_INCALL_REC_TX] = strdup("INCALL_RECORD_TX");
|
||||
|
||||
my_data->max_mic_count = PLATFORM_DEFAULT_MIC_COUNT;
|
||||
|
||||
|
@ -3765,6 +3773,11 @@ int platform_split_snd_device(void *platform,
|
|||
new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
|
||||
new_snd_devices[1] = SND_DEVICE_OUT_BT_A2DP;
|
||||
ret = 0;
|
||||
} else if (SND_DEVICE_IN_INCALL_REC_RX_TX == snd_device) {
|
||||
*num_devices = 2;
|
||||
new_snd_devices[0] = SND_DEVICE_IN_INCALL_REC_RX;
|
||||
new_snd_devices[1] = SND_DEVICE_IN_INCALL_REC_TX;
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
ALOGD("%s: snd_device(%d) num devices(%d) new_snd_devices(%d)", __func__,
|
||||
|
|
|
@ -247,6 +247,9 @@ enum {
|
|||
SND_DEVICE_IN_EC_REF_LOOPBACK_MONO,
|
||||
SND_DEVICE_IN_EC_REF_LOOPBACK_STEREO,
|
||||
SND_DEVICE_IN_HANDSET_GENERIC_QMIC,
|
||||
SND_DEVICE_IN_INCALL_REC_RX,
|
||||
SND_DEVICE_IN_INCALL_REC_TX,
|
||||
SND_DEVICE_IN_INCALL_REC_RX_TX,
|
||||
SND_DEVICE_IN_END,
|
||||
|
||||
SND_DEVICE_MAX = SND_DEVICE_IN_END,
|
||||
|
|
21
hal/voice.c
21
hal/voice.c
|
@ -440,6 +440,27 @@ int voice_check_and_stop_incall_rec_usecase(struct audio_device *adev,
|
|||
return ret;
|
||||
}
|
||||
|
||||
snd_device_t voice_get_incall_rec_backend_device(struct stream_in *in)
|
||||
{
|
||||
snd_device_t incall_record_device = {0};
|
||||
|
||||
switch(in->source) {
|
||||
case AUDIO_SOURCE_VOICE_UPLINK:
|
||||
incall_record_device = SND_DEVICE_IN_INCALL_REC_TX;
|
||||
break;
|
||||
case AUDIO_SOURCE_VOICE_DOWNLINK:
|
||||
incall_record_device = SND_DEVICE_IN_INCALL_REC_RX;
|
||||
break;
|
||||
case AUDIO_SOURCE_VOICE_CALL:
|
||||
incall_record_device = SND_DEVICE_IN_INCALL_REC_RX_TX;
|
||||
break;
|
||||
default:
|
||||
ALOGI("Invalid source %d", in->source);
|
||||
}
|
||||
|
||||
return incall_record_device;
|
||||
}
|
||||
|
||||
snd_device_t voice_get_incall_rec_snd_device(snd_device_t in_snd_device)
|
||||
{
|
||||
snd_device_t incall_record_device = in_snd_device;
|
||||
|
|
|
@ -103,5 +103,5 @@ void voice_check_and_update_aanc_path(struct audio_device *adev,
|
|||
bool enable);
|
||||
bool voice_is_call_state_active(struct audio_device *adev);
|
||||
void voice_set_device_mute_flag (struct audio_device *adev, bool state);
|
||||
|
||||
snd_device_t voice_get_incall_rec_backend_device(struct stream_in *in);
|
||||
#endif //VOICE_H
|
||||
|
|
Loading…
Reference in New Issue