tsync: do not operate tsync_mode_switch before first video toggled [1/1]
authorYingwei Long <yingwei.long@amlogic.com>
Thu, 28 Feb 2019 12:01:24 +0000 (20:01 +0800)
committerYingwei Long <yingwei.long@amlogic.com>
Mon, 4 Mar 2019 09:29:44 +0000 (17:29 +0800)
PD#SWPL-5131

Problem:
Some stream in tunnel mode, first audio pts is large than
AV_DISCONTINUE_THREDHOLD_MAX(60s). In audio_hw it will check pcr and
apts diff, so large difference between pcr and apts will lead sync mode
from amster to vmaster(egg:SYNC-HEVC-59FPS-DDP51)

Solution:
do not operate tsync_mode_switch before first video toggled

Verify:
verify by franklin

Change-Id: Icec2de71ea8f838146444aa3ea880f76ed8e0f13
Signed-off-by: Yingwei Long <yingwei.long@amlogic.com>
drivers/amlogic/media/frame_sync/tsync.c

index df091fe..2b41eb1 100644 (file)
@@ -1155,8 +1155,9 @@ int tsync_set_apts(unsigned int pts)
                t = timestamp_vpts_get();
        else
                t = timestamp_pcrscr_get();
+       /* do not switch tsync mode until first video toggled. */
        if ((abs(oldpts - pts) > tsync_av_threshold_min) &&
-               (!get_vsync_pts_inc_mode())) {  /* is discontinue */
+               (timestamp_firstvpts_get() > 0)) {      /* is discontinue */
                apts_discontinue = 1;
                tsync_mode_switch('A', abs(pts - t),
                                pts - oldpts);  /*if in VMASTER ,just wait */