hal: Limit multichannel clips >48khz to 48Khz
-Configuring copp and backend at 48Khz for multichannel
clips > 48khz
-This is to address ADSP MIPS concern for playback of multichannel
clip with sample rate > 48khz with pp (SA+ or SA+_HPX)
Change-Id: Ic010ce212011519e729601d067f8ddb6737c6b28
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index 531cf69..e917367 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -480,12 +480,14 @@
audio_format_t format,
uint32_t sample_rate,
uint32_t bit_width,
+ audio_channel_mask_t channel_mask,
struct stream_app_type_cfg *app_type_cfg)
{
struct listnode *node_i, *node_j, *node_k;
struct streams_output_cfg *so_info;
struct stream_format *sf_info;
struct stream_sample_rate *ss_info;
+ char value[PROPERTY_VALUE_MAX] = {0};
if ((24 == bit_width) &&
(devices & AUDIO_DEVICE_OUT_SPEAKER)) {
@@ -496,6 +498,16 @@
ALOGI("%s Allowing 24-bit playback on speaker ONLY at default sampling rate", __func__);
}
+ property_get("audio.playback.mch.downsample",value,"");
+ if (!strncmp("true", value, sizeof("true"))) {
+ if ((popcount(channel_mask) > 2) &&
+ (sample_rate > CODEC_BACKEND_DEFAULT_SAMPLE_RATE) &&
+ !(flags & AUDIO_OUTPUT_FLAG_COMPRESS_PASSTHROUGH)) {
+ sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
+ ALOGD("%s: MCH session defaulting sample rate to %d",
+ __func__, sample_rate);
+ }
+ }
ALOGV("%s: flags: %x, format: %x sample_rate %d",
__func__, flags, format, sample_rate);
list_for_each(node_i, streams_output_cfg_list) {
@@ -537,6 +549,7 @@
struct mixer_ctl *ctl;
int pcm_device_id, acdb_dev_id, snd_device = usecase->out_snd_device;
int32_t sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
+ char value[PROPERTY_VALUE_MAX] = {0};
ALOGV("%s", __func__);
@@ -589,6 +602,14 @@
}
sample_rate = out->app_type_cfg.sample_rate;
+ property_get("audio.playback.mch.downsample",value,"");
+ if (!strncmp("true", value, sizeof("true"))) {
+ if ((popcount(out->channel_mask) > 2) &&
+ (out->sample_rate > CODEC_BACKEND_DEFAULT_SAMPLE_RATE) &&
+ !(out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_PASSTHROUGH))
+ sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
+ }
+
app_type_cfg[len++] = out->app_type_cfg.app_type;
app_type_cfg[len++] = acdb_dev_id;
if (((out->format == AUDIO_FORMAT_E_AC3) ||