audio: audio server crash [1/1]

PD#SWPL-192526

Problem:
modify the use of patch->stream_out.

Solution:
modify the use of patch->stream_out.

Verify:
yocto-ap222

Change-Id: Ifa1133ffcf56645f086440effdfe46f0d8a6427c
Signed-off-by: yayun.shi <yayun.shi@amlogic.com>
diff --git a/input/tv_patch.c b/input/tv_patch.c
index a2832db..72b1041 100644
--- a/input/tv_patch.c
+++ b/input/tv_patch.c
@@ -163,12 +163,6 @@
     }
     //AM_LOGI("apatch(%p) set av sync status to %d", apatch, need_do_avsync);
     apatch->need_do_avsync = need_do_avsync;
-    //When doing AV sync, it is necessary to mute, and then unmute after AV sync ends
-    struct aml_stream_out* aml_out = (struct aml_stream_out*)apatch->stream_out;
-    if (aml_out) {
-        aml_out->mute = need_do_avsync;
-        //AM_LOGI("apatch(%p) set stream(%p) mute to %d", apatch, aml_out, need_do_avsync);
-    }
 }
 
 // buffer/period ratio, bigger will add more latency
@@ -430,7 +424,7 @@
     struct dolby_ms12_desc *ms12 = &(aml_dev->ms12);
     ring_buffer_t *ringbuffer = & (patch->aml_ringbuffer);
     struct audio_stream_out *stream_out = NULL;
-    struct aml_stream_out *aml_out = NULL,*out;
+    struct aml_stream_out *out= NULL;
     struct audio_config stream_config;
     struct timespec ts;
     int write_bytes = DEFAULT_PLAYBACK_PERIOD_SIZE * PLAYBACK_PERIOD_COUNT;
@@ -648,6 +642,11 @@
             }
 
             /* avsync for dev->dev patch*/
+            //When doing AV sync, it is necessary to mute, and then unmute after AV sync ends
+            if (out->mute != patch->need_do_avsync) {
+                out->mute = patch->need_do_avsync;
+                AM_LOGI("set stream mute to %d", out->mute);
+            }
             if (patch && (patch->need_do_avsync == true) && (patch->input_signal_stable == true) &&
                     (SRC_ATV == patch->patch_src || SRC_HDMIIN == patch->patch_src ||
                     SRC_LINEIN == patch->patch_src || SRC_SPDIFIN == patch->patch_src)) {