Audio: ad cann't disable for single pid ddp [1/1]

PD#SWPL-177948

Problem:
for single pid ddp stream, need use ad mix level
to control ad.

Solution:
complete this follow.

Verify:
yocto.

Change-Id: I5f79b5cb49ce6eb2a6ad48152fdf47ac383b0fdf
Signed-off-by: wei.wang1 <wei.wang1@amlogic.com>
diff --git a/input/dtv_patch.c b/input/dtv_patch.c
index c68e51b..e5f74e1 100644
--- a/input/dtv_patch.c
+++ b/input/dtv_patch.c
@@ -327,9 +327,6 @@
             }
             adev->mixing_level = (val * 64 - 32 * 100) / 100; //[0,100] mapping to [-32,32]
             AM_LOGI("mixing_level set to %d", adev->mixing_level);
-            if (path->dtv_aml_out && eDolbyMS12Lib == adev->dolby_lib_type) {
-                set_ms12_ad_mixing_level((struct audio_stream_out *)path->dtv_aml_out, adev->mixing_level);
-            }
             break;
         case AUDIO_DTV_PATCH_CMD_SET_MEDIA_PRESENTATION_ID:
             demux_info->media_presentation_id = val;
@@ -521,6 +518,9 @@
         if (!aml_out->aml_dec && aml_out->hal_format == AUDIO_FORMAT_E_AC3 && aml_dev->dolby_lib_type == eDolbyDcvLib) {
             aml_out->ad_substream_supported = is_ad_substream_supported((unsigned char *)mEsData->data, mEsData->size);
         }
+        if (aml_out->hal_format == AUDIO_FORMAT_AC4 || aml_out->ad_substream_supported) {
+            dtv_update_ad_vol_parameter(path);
+        }
 
         //decode data
         ret = stream_out->write(stream_out, mEsData->data, mEsData->size);
@@ -1073,6 +1073,7 @@
 }
 
 static void dtv_set_decoder_gain(dtv_path_t *path, struct audio_stream_out *stream) {
+    R_CHECK_POINTER_LEGAL(, stream, "");
     struct aml_stream_out *aml_out = (struct aml_stream_out *) stream;
     struct aml_audio_device *adev = (struct aml_audio_device *)adev_get_handle();
     float gain = 1.0;
@@ -1133,7 +1134,7 @@
         main_aml_out->dec_param.mixing_level = aml_dev->mixing_level;
         if (eDolbyMS12Lib == aml_dev->dolby_lib_type) {////set to ms12
             set_ms12_ad_mixing_level((struct audio_stream_out *)main_aml_out, aml_dev->mixing_level);
-        } else if (ad_aml_out->hal_format == AUDIO_FORMAT_AC3 || ad_aml_out->hal_format == AUDIO_FORMAT_E_AC3) {
+        } else if (main_aml_out->hal_format == AUDIO_FORMAT_AC3 || main_aml_out->hal_format == AUDIO_FORMAT_E_AC3) {
             main_aml_out->dec_config.mixer_level = aml_dev->mixing_level;
             aml_decoder_set_config(main_aml_out->aml_dec, AML_DEC_CONFIG_MIXER_LEVEL, &main_aml_out->dec_config);//set to dcv
         } else {