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
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index 0ea8b56..0a48953 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -873,6 +873,25 @@
}
}
+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 @@
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 @@
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 @@
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 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 @@
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;