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 976cfe9..04d62c6 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -4046,6 +4046,22 @@
     if (!is_external_codec)
         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);
+         }
+    }
+
+
 
     ALOGI("%s Codec selected backend: %d updated bit width: %d and sample rate: %d",
                __func__, backend_idx, bit_width, sample_rate);