Loading hal/audio_extn/utils.c +47 −30 Original line number Diff line number Diff line Loading @@ -499,11 +499,13 @@ void audio_extn_utils_update_stream_app_type_cfg(void *platform, app_type_cfg->bit_width = 16; } #define GENERAL_RECORDING_APP_TYPE 0x11132 int audio_extn_utils_send_app_type_cfg(struct audio_usecase *usecase) { char mixer_ctl_name[MAX_LENGTH_MIXER_CONTROL_IN_INT]; int app_type_cfg[MAX_LENGTH_MIXER_CONTROL_IN_INT], len = 0, rc; struct stream_out *out; struct stream_in *in; struct audio_device *adev; struct mixer_ctl *ctl; int pcm_device_id, acdb_dev_id, snd_device = usecase->out_snd_device; Loading @@ -511,25 +513,32 @@ int audio_extn_utils_send_app_type_cfg(struct audio_usecase *usecase) ALOGV("%s", __func__); if (usecase->type != PCM_PLAYBACK) { ALOGV("%s: not a playback path, no need to cfg app type", __func__); if (usecase->type != PCM_PLAYBACK && usecase->type != PCM_CAPTURE) { ALOGE("%s: not a playback or capture path, no need to cfg app type", __func__); rc = 0; goto exit_send_app_type_cfg; } if ((usecase->id != USECASE_AUDIO_PLAYBACK_DEEP_BUFFER) && (usecase->id != USECASE_AUDIO_PLAYBACK_LOW_LATENCY) && (usecase->id != USECASE_AUDIO_PLAYBACK_MULTI_CH) && (!is_offload_usecase(usecase->id))) { (!is_offload_usecase(usecase->id)) && (usecase->type != PCM_CAPTURE)) { ALOGV("%s: a playback path where app type cfg is not required %d", __func__, usecase->id); rc = 0; goto exit_send_app_type_cfg; } if (usecase->type == PCM_PLAYBACK) { out = usecase->stream.out; adev = out->dev; snd_device = usecase->out_snd_device; pcm_device_id = platform_get_pcm_device_id(out->usecase, PCM_PLAYBACK); } if (usecase->type == PCM_CAPTURE) { in = usecase->stream.in; adev = in->dev; snd_device = usecase->in_snd_device; pcm_device_id = platform_get_pcm_device_id(in->usecase, PCM_CAPTURE); } snprintf(mixer_ctl_name, sizeof(mixer_ctl_name), "Audio Stream %d App Type Cfg", pcm_device_id); Loading @@ -550,6 +559,7 @@ int audio_extn_utils_send_app_type_cfg(struct audio_usecase *usecase) goto exit_send_app_type_cfg; } if (usecase->type == PCM_PLAYBACK) { if ((24 == usecase->stream.out->bit_width) && (usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER)) { sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE; Loading @@ -572,10 +582,17 @@ int audio_extn_utils_send_app_type_cfg(struct audio_usecase *usecase) app_type_cfg[len++] = sample_rate * 4; else app_type_cfg[len++] = sample_rate; mixer_ctl_set_array(ctl, app_type_cfg, len); ALOGI("%s app_type %d, acdb_dev_id %d, sample_rate %d", ALOGI("%s PLAYBACK app_type %d, acdb_dev_id %d, sample_rate %d", __func__, out->app_type_cfg.app_type, acdb_dev_id, sample_rate); } else if (usecase->type == PCM_CAPTURE) { app_type_cfg[len++] = GENERAL_RECORDING_APP_TYPE; app_type_cfg[len++] = acdb_dev_id; app_type_cfg[len++] = sample_rate; ALOGI("%s CAPTURE app_type %d, acdb_dev_id %d, sample_rate %d", __func__, platform_get_default_app_type(adev->platform), acdb_dev_id, sample_rate); } mixer_ctl_set_array(ctl, app_type_cfg, len); rc = 0; exit_send_app_type_cfg: return rc; Loading Loading
hal/audio_extn/utils.c +47 −30 Original line number Diff line number Diff line Loading @@ -499,11 +499,13 @@ void audio_extn_utils_update_stream_app_type_cfg(void *platform, app_type_cfg->bit_width = 16; } #define GENERAL_RECORDING_APP_TYPE 0x11132 int audio_extn_utils_send_app_type_cfg(struct audio_usecase *usecase) { char mixer_ctl_name[MAX_LENGTH_MIXER_CONTROL_IN_INT]; int app_type_cfg[MAX_LENGTH_MIXER_CONTROL_IN_INT], len = 0, rc; struct stream_out *out; struct stream_in *in; struct audio_device *adev; struct mixer_ctl *ctl; int pcm_device_id, acdb_dev_id, snd_device = usecase->out_snd_device; Loading @@ -511,25 +513,32 @@ int audio_extn_utils_send_app_type_cfg(struct audio_usecase *usecase) ALOGV("%s", __func__); if (usecase->type != PCM_PLAYBACK) { ALOGV("%s: not a playback path, no need to cfg app type", __func__); if (usecase->type != PCM_PLAYBACK && usecase->type != PCM_CAPTURE) { ALOGE("%s: not a playback or capture path, no need to cfg app type", __func__); rc = 0; goto exit_send_app_type_cfg; } if ((usecase->id != USECASE_AUDIO_PLAYBACK_DEEP_BUFFER) && (usecase->id != USECASE_AUDIO_PLAYBACK_LOW_LATENCY) && (usecase->id != USECASE_AUDIO_PLAYBACK_MULTI_CH) && (!is_offload_usecase(usecase->id))) { (!is_offload_usecase(usecase->id)) && (usecase->type != PCM_CAPTURE)) { ALOGV("%s: a playback path where app type cfg is not required %d", __func__, usecase->id); rc = 0; goto exit_send_app_type_cfg; } if (usecase->type == PCM_PLAYBACK) { out = usecase->stream.out; adev = out->dev; snd_device = usecase->out_snd_device; pcm_device_id = platform_get_pcm_device_id(out->usecase, PCM_PLAYBACK); } if (usecase->type == PCM_CAPTURE) { in = usecase->stream.in; adev = in->dev; snd_device = usecase->in_snd_device; pcm_device_id = platform_get_pcm_device_id(in->usecase, PCM_CAPTURE); } snprintf(mixer_ctl_name, sizeof(mixer_ctl_name), "Audio Stream %d App Type Cfg", pcm_device_id); Loading @@ -550,6 +559,7 @@ int audio_extn_utils_send_app_type_cfg(struct audio_usecase *usecase) goto exit_send_app_type_cfg; } if (usecase->type == PCM_PLAYBACK) { if ((24 == usecase->stream.out->bit_width) && (usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER)) { sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE; Loading @@ -572,10 +582,17 @@ int audio_extn_utils_send_app_type_cfg(struct audio_usecase *usecase) app_type_cfg[len++] = sample_rate * 4; else app_type_cfg[len++] = sample_rate; mixer_ctl_set_array(ctl, app_type_cfg, len); ALOGI("%s app_type %d, acdb_dev_id %d, sample_rate %d", ALOGI("%s PLAYBACK app_type %d, acdb_dev_id %d, sample_rate %d", __func__, out->app_type_cfg.app_type, acdb_dev_id, sample_rate); } else if (usecase->type == PCM_CAPTURE) { app_type_cfg[len++] = GENERAL_RECORDING_APP_TYPE; app_type_cfg[len++] = acdb_dev_id; app_type_cfg[len++] = sample_rate; ALOGI("%s CAPTURE app_type %d, acdb_dev_id %d, sample_rate %d", __func__, platform_get_default_app_type(adev->platform), acdb_dev_id, sample_rate); } mixer_ctl_set_array(ctl, app_type_cfg, len); rc = 0; exit_send_app_type_cfg: return rc; Loading