hal: Fix combo device configuration for 24 bit playback on speaker
-Fix combo device configuration for 24 bit playback on speaker -Move exception hadndling code to audio_extn Change-Id: Ia0985a284042a5ac5e3de64aaf5e4d57462ceb85
This commit is contained in:
parent
987af8e86b
commit
1d89604def
|
@ -309,6 +309,7 @@ void audio_extn_utils_release_streams_output_cfg_list(
|
|||
struct listnode *streams_output_cfg_list);
|
||||
void audio_extn_utils_update_stream_app_type_cfg(void *platform,
|
||||
struct listnode *streams_output_cfg_list,
|
||||
audio_devices_t devices,
|
||||
audio_output_flags_t flags,
|
||||
audio_format_t format,
|
||||
uint32_t sample_rate,
|
||||
|
|
|
@ -422,6 +422,7 @@ static bool set_output_cfg(struct streams_output_cfg *so_info,
|
|||
|
||||
void audio_extn_utils_update_stream_app_type_cfg(void *platform,
|
||||
struct listnode *streams_output_cfg_list,
|
||||
audio_devices_t devices,
|
||||
audio_output_flags_t flags,
|
||||
audio_format_t format,
|
||||
uint32_t sample_rate,
|
||||
|
@ -433,7 +434,14 @@ void audio_extn_utils_update_stream_app_type_cfg(void *platform,
|
|||
struct stream_format *sf_info;
|
||||
struct stream_sample_rate *ss_info;
|
||||
|
||||
ALOGV("%s: flags: %x, format: %x", __func__, flags, format);
|
||||
if ((24 == bit_width) &&
|
||||
(devices & AUDIO_DEVICE_OUT_SPEAKER)) {
|
||||
sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
|
||||
ALOGI("%s Allowing 24-bit playback on speaker ONLY at default sampling rate", __func__);
|
||||
}
|
||||
|
||||
ALOGV("%s: flags: %x, format: %x sample_rate %d",
|
||||
__func__, flags, format, sample_rate);
|
||||
list_for_each(node_i, streams_output_cfg_list) {
|
||||
so_info = node_to_item(node_i, struct streams_output_cfg, list);
|
||||
if (so_info->flags == flags) {
|
||||
|
@ -516,7 +524,7 @@ int audio_extn_utils_send_app_type_cfg(struct audio_usecase *usecase)
|
|||
}
|
||||
|
||||
if ((24 == usecase->stream.out->bit_width) &&
|
||||
(AUDIO_DEVICE_OUT_SPEAKER == snd_device)) {
|
||||
(usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER)) {
|
||||
sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
|
||||
} else {
|
||||
sample_rate = out->app_type_cfg.sample_rate;
|
||||
|
|
|
@ -822,26 +822,17 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
|
|||
usecase->out_snd_device = out_snd_device;
|
||||
|
||||
if (usecase->type == PCM_PLAYBACK) {
|
||||
if ((24 == usecase->stream.out->bit_width) &&
|
||||
(AUDIO_DEVICE_OUT_SPEAKER == usecase->stream.out->devices)) {
|
||||
audio_extn_utils_update_stream_app_type_cfg(adev->platform,
|
||||
&adev->streams_output_cfg_list,
|
||||
usecase->stream.out->flags,
|
||||
usecase->stream.out->format,
|
||||
DEFAULT_OUTPUT_SAMPLING_RATE,
|
||||
usecase->stream.out->bit_width,
|
||||
&usecase->stream.out->app_type_cfg);
|
||||
} else {
|
||||
audio_extn_utils_update_stream_app_type_cfg(adev->platform,
|
||||
audio_extn_utils_update_stream_app_type_cfg(adev->platform,
|
||||
&adev->streams_output_cfg_list,
|
||||
usecase->stream.out->devices,
|
||||
usecase->stream.out->flags,
|
||||
usecase->stream.out->format,
|
||||
usecase->stream.out->sample_rate,
|
||||
usecase->stream.out->bit_width,
|
||||
&usecase->stream.out->app_type_cfg);
|
||||
}
|
||||
ALOGI("%s Selected apptype: %d", __func__, usecase->stream.out->app_type_cfg.app_type);
|
||||
ALOGI("%s Selected apptype: %d", __func__, usecase->stream.out->app_type_cfg.app_type);
|
||||
}
|
||||
|
||||
enable_audio_route(adev, usecase);
|
||||
|
||||
/* Applicable only on the targets that has external modem.
|
||||
|
@ -2433,7 +2424,6 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
|
|||
struct stream_out *out;
|
||||
int i, ret = 0;
|
||||
audio_format_t format;
|
||||
int32_t sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
|
||||
|
||||
*stream_out = NULL;
|
||||
|
||||
|
@ -2619,20 +2609,11 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
|
|||
out->sample_rate = out->config.rate;
|
||||
}
|
||||
|
||||
if ((24 == out->bit_width) &&
|
||||
(devices == AUDIO_DEVICE_OUT_SPEAKER)) {
|
||||
sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
|
||||
ALOGI("%s 24-bit playback on Speaker is allowed ONLY at 48khz. Hence changing sample rate to: %d",
|
||||
__func__, sample_rate);
|
||||
} else {
|
||||
sample_rate = out->sample_rate;
|
||||
}
|
||||
|
||||
ALOGV("%s flags %x, format %x, sample_rate %d, out->bit_width %d",
|
||||
__func__, flags, format, sample_rate, out->bit_width);
|
||||
ALOGV("%s devices %d,flags %x, format %x, out->sample_rate %d, out->bit_width %d",
|
||||
__func__, devices, flags, format, out->sample_rate, out->bit_width);
|
||||
audio_extn_utils_update_stream_app_type_cfg(adev->platform,
|
||||
&adev->streams_output_cfg_list,
|
||||
flags, format, sample_rate,
|
||||
devices, flags, format, out->sample_rate,
|
||||
out->bit_width, &out->app_type_cfg);
|
||||
if ((out->usecase == USECASE_AUDIO_PLAYBACK_PRIMARY) ||
|
||||
(flags & AUDIO_OUTPUT_FLAG_PRIMARY)) {
|
||||
|
|
|
@ -2559,9 +2559,11 @@ bool platform_check_codec_backend_cfg(struct audio_device* adev,
|
|||
}
|
||||
}
|
||||
|
||||
// 16 bit playbacks is allowed through 16 bit/48 khz backend only
|
||||
// 24 bit playback on speakers and all 16 bit playbacks is allowed through
|
||||
// 16 bit/48 khz backend only
|
||||
if ((16 == bit_width) ||
|
||||
((24 == bit_width) && (SND_DEVICE_OUT_SPEAKER == usecase->devices))) {
|
||||
((24 == bit_width) &&
|
||||
(usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER))) {
|
||||
sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
|
||||
}
|
||||
// Force routing if the expected bitwdith or samplerate
|
||||
|
|
Loading…
Reference in New Issue