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/msm8916/platform.c b/hal/msm8916/platform.c
index 8acfa43..3fd8ad3 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -3441,6 +3441,7 @@
struct stream_out *out = NULL;
unsigned int bit_width = CODEC_BACKEND_DEFAULT_BIT_WIDTH;
unsigned int sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
+ char value[PROPERTY_VALUE_MAX] = {0};
// For voice calls use default configuration
// force routing is not required here, caller will do it anyway
@@ -3480,6 +3481,22 @@
if (16 == bit_width) {
sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
}
+
+ //check if mulitchannel clip needs to be down sampled to 48k
+ property_get("audio.playback.mch.downsample",value,"");
+ if (!strncmp("true", value, sizeof("true"))) {
+ out = usecase->stream.out;
+ 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;
+ /* update out sample rate to reflect current backend sample rate */
+ out->sample_rate = sample_rate;
+ ALOGD("%s: MCH session defaulting sample rate to %d",
+ __func__, sample_rate);
+ }
+ }
+
// 24 bit playback on speakers is allowed through 48 khz backend only
// bit width re-configured based on platform info
if ((24 == bit_width) &&