From 5ab25fe0dbb23ab7ff38e4b821fa0ac6ca5fe72f Mon Sep 17 00:00:00 2001 From: "shuanglong.wang" Date: Mon, 14 May 2018 16:33:49 +0800 Subject: [PATCH] avsync: av not sync problem cased by vp9 trig PD#161895: av not sync problem cased by vp9 trig 1)vp9 initialization stream do not post VIDEO_START event, so do not post VIDEO_STOP in unregister when not post VIDEO_START which occured in vp9 tirg reset codec operation. 2)AV audio master adjust pcr according apts diff in tsync tsync_set_apts need to reopen which was commented in the begining tree of 4.9 codec 3)summit as Tim's patch Change-Id: I9fb62aecb27f75d1ea9dff938452e0dd4f11b901 Signed-off-by: shuanglong.wang --- drivers/amlogic/media/frame_sync/tsync.c | 6 +++--- drivers/amlogic/media/video_sink/video.c | 13 ++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/amlogic/media/frame_sync/tsync.c b/drivers/amlogic/media/frame_sync/tsync.c index 23c5606..361868b 100644 --- a/drivers/amlogic/media/frame_sync/tsync.c +++ b/drivers/amlogic/media/frame_sync/tsync.c @@ -1058,7 +1058,7 @@ int tsync_set_apts(unsigned int pts) unsigned int t; /* ssize_t r; */ unsigned int oldpts = timestamp_apts_get(); - /*int oldmod = tsync_mode;*/ + int oldmod = tsync_mode; if (tsync_abreak) tsync_abreak = 0; @@ -1084,7 +1084,7 @@ int tsync_set_apts(unsigned int pts) if (tsync_mode == TSYNC_MODE_AMASTER) t = timestamp_pcrscr_get(); -#if 0//DEBUG_TMP + if (tsync_mode == TSYNC_MODE_AMASTER) { /* special used for Dobly Certification AVSync test */ if (dobly_avsync_test) { @@ -1133,7 +1133,7 @@ int tsync_set_apts(unsigned int pts) } } else if (oldmod != tsync_mode && tsync_mode == TSYNC_MODE_VMASTER) timestamp_pcrscr_set(timestamp_vpts_get()); -#endif + return 0; } EXPORT_SYMBOL(tsync_set_apts); diff --git a/drivers/amlogic/media/video_sink/video.c b/drivers/amlogic/media/video_sink/video.c index 75515f8..5f63e46 100644 --- a/drivers/amlogic/media/video_sink/video.c +++ b/drivers/amlogic/media/video_sink/video.c @@ -131,6 +131,7 @@ static int receive_frame_count; static int display_frame_count; static int omx_need_drop_frame_num; static bool omx_drop_done; +static bool video_start_post; /*----omx_info bit0: keep_last_frame, bit1~31: unused----*/ static u32 omx_info = 0x1; @@ -4655,10 +4656,12 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id) vf = video_vf_peek(); if (vf) { - if (hdmi_in_onvideo == 0) + if (hdmi_in_onvideo == 0) { tsync_avevent_locked(VIDEO_START, (vf->pts) ? vf->pts : timestamp_vpts_get()); + video_start_post = true; + } if (show_first_frame_nosync || show_first_picture) show_nosync = true; @@ -6043,14 +6046,18 @@ static void video_vf_unreg_provider(void) /* TODO: mod gate */ /* switch_mod_gate_by_name("ge2d", 0); */ } - if (hdmi_in_onvideo == 0) + if ((hdmi_in_onvideo == 0) && (video_start_post)) { tsync_avevent(VIDEO_STOP, 0); + video_start_post = false; + } #else /* if (!trickmode_fffb) */ if (cur_dispbuf) keeped = vf_keep_current(cur_dispbuf, el_vf); - if (hdmi_in_onvideo == 0) + if ((hdmi_in_onvideo == 0) && (video_start_post)) { tsync_avevent(VIDEO_STOP, 0); + video_start_post = false; + } #endif if (keeped < 0) {/*keep failed.*/ pr_info("video keep failed, disable video now!\n"); -- 2.7.4