hal: Fix mute issue for unsupported sample rate in passthru mode

-Mute is observed when passthrough session is opened with
 unsupported sampling rate
-Return error when stream sampling rate is not supported
 by the sink during compress passthrough playback
-Add correct condiiton check for convert usecases

Change-Id: Iea236f5076617a583b7882741b76468294fac013
CRs-fixed: 2096943
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index 8ee5948..c1cc9ee 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -1676,7 +1676,7 @@
     struct mixer_ctl *ctl;
     ALOGV("%s: buffer %s bytes %zd", __func__, buffer, bytes);
 #ifdef HDMI_PASSTHROUGH_ENABLED
-    if (audio_extn_is_dolby_format(out->format) &&
+    if (audio_extn_utils_is_dolby_format(out->format) &&
         /*TODO:Extend code to support DTS passthrough*/
         /*set compressed channel status bits*/
         audio_extn_passthru_is_passthrough_stream(out)){
@@ -2351,3 +2351,15 @@
 exit:
     return ret;
 }
+
+bool audio_extn_utils_is_dolby_format(audio_format_t format)
+{
+    if (format == AUDIO_FORMAT_AC3 ||
+            format == AUDIO_FORMAT_E_AC3 ||
+            format == AUDIO_FORMAT_E_AC3_JOC)
+        return true;
+    else
+        return false;
+}
+
+