From 97aec8956f96ae6fb2e23c6b0ba2ac3aafbd2979 Mon Sep 17 00:00:00 2001 From: "live.li" Date: Thu, 22 Nov 2018 10:05:53 +0800 Subject: [PATCH] avsync: tsync: fix the avsync problem [1/1] PD#SWPL-1158 Problem: The video will become un-smooth after change between several audio languages Solution: when apts and vpts distance is large then 60*90000 then set the tsync mode to vmaster and set the tysnc enable to 0 Verify: P321 Change-Id: I7c7e32f49ca12645cf6a1aa58caeb968a9234c8c Signed-off-by: live.li --- drivers/amlogic/media/frame_sync/timestamp.c | 1 + drivers/amlogic/media/frame_sync/tsync.c | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/amlogic/media/frame_sync/timestamp.c b/drivers/amlogic/media/frame_sync/timestamp.c index c5bcf05..66ff3d4 100644 --- a/drivers/amlogic/media/frame_sync/timestamp.c +++ b/drivers/amlogic/media/frame_sync/timestamp.c @@ -136,6 +136,7 @@ EXPORT_SYMBOL(timestamp_pcrscr_get); void timestamp_pcrscr_set(u32 pts) { + pr_info("timestamp_pcrscr_set system time = %x\n", pts); system_time = pts; } EXPORT_SYMBOL(timestamp_pcrscr_set); diff --git a/drivers/amlogic/media/frame_sync/tsync.c b/drivers/amlogic/media/frame_sync/tsync.c index 6c79379..bb5205c 100644 --- a/drivers/amlogic/media/frame_sync/tsync.c +++ b/drivers/amlogic/media/frame_sync/tsync.c @@ -745,17 +745,18 @@ void tsync_avevent_locked(enum avevent_e event, u32 param) switch (event) { case VIDEO_START: tsync_video_started = 1; - /* - *set tsync mode to vmaster to avoid video block caused - *by avpts-diff too much - *threshold 120s is an arbitrary value - */ + + //set tsync mode to vmaster to avoid video block caused + // by avpts-diff too much + //threshold 120s is an arbitrary value + if (tsync_enable && !get_vsync_pts_inc_mode()) tsync_mode = TSYNC_MODE_AMASTER; - else { + else{ tsync_mode = TSYNC_MODE_VMASTER; if (get_vsync_pts_inc_mode()) tsync_stat = TSYNC_STAT_PCRSCR_SETUP_NONE; + } if (tsync_dec_reset_flag) @@ -786,6 +787,8 @@ void tsync_avevent_locked(enum avevent_e event, u32 param) if (abs(param - t) > tsync_av_threshold_max) { /* if this happens, then play */ tsync_stat = TSYNC_STAT_PCRSCR_SETUP_VIDEO; + tsync_mode = TSYNC_MODE_VMASTER; + tsync_enable = 0; timestamp_pcrscr_set(param); set_pts_realign(); } @@ -822,7 +825,6 @@ void tsync_avevent_locked(enum avevent_e event, u32 param) case VIDEO_TSTAMP_DISCONTINUITY: { unsigned int oldpts = timestamp_vpts_get(); int oldmod = tsync_mode; - if (tsync_mode == TSYNC_MODE_VMASTER) t = timestamp_apts_get(); else @@ -838,6 +840,7 @@ void tsync_avevent_locked(enum avevent_e event, u32 param) tsync_mode_switch('V', abs(param - t), param - oldpts); } + timestamp_vpts_set(param); if (tsync_mode == TSYNC_MODE_VMASTER) { timestamp_pcrscr_set(param); @@ -866,7 +869,6 @@ void tsync_avevent_locked(enum avevent_e event, u32 param) t = timestamp_vpts_get(); else t = timestamp_pcrscr_get(); - amlog_level(LOG_LEVEL_ATTENTION, "AUDIO_TSTAMP_DISCONTINUITY, 0x%x, 0x%x\n", t, param); -- 2.7.4