tsync: do not operate tsync_mode_switch before first video toggled.
authorshuanglong.wang <shuanglong.wang@amlogic.com>
Mon, 14 May 2018 06:49:39 +0000 (14:49 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Thu, 17 May 2018 13:54:11 +0000 (06:54 -0700)
PD#165355: do not operate tsync_mode_switch before first video toggled.
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
[ 2414.316223@3] vdec_init, dev_name:ammvdec_vp9,
vdec_type=VDEC_TYPE_STREAM_PARSER
[ 2414.326361@3] vp9: ver (201602101,0) decinfo: 1920x1080 rate=4000
[ 2414.326827@3] mem_start_virt failed
[ 2414.330600@3] init_pic_list ok, used_buf_num = 12
[ 2414.336555@2] set pts unstable
[ 2414.338121@2] success set parent hevc_p1_composite rate to 666666666
[ 2414.356287@0]
A-discontinue,pcr=1500,vpts=0,apts=1500,diff_pts=16209420,lugsp_5ts6
207920
[ 2414.359685@0] discontinue-tsync_mode:A->Vvptatr:S->adji
ffies=204004utsize 12179
[ 2414.366696@0] debugcnt=0x10,diff_pts=16209420,tsync_mode=0

Change-Id: I7e33abb5e6c27169ecec86fb6e4df33de6bd80cf
Signed-off-by: shuanglong.wang <shuanglong.wang@amlogic.com>
drivers/amlogic/media/frame_sync/tsync.c

index 361868b..f58166d 100644 (file)
@@ -1070,7 +1070,9 @@ int tsync_set_apts(unsigned int pts)
                t = timestamp_vpts_get();
        else
                t = timestamp_pcrscr_get();
-       if ((abs(oldpts - pts) > tsync_av_threshold_min)
+       /* do not switch tsync mode until first video toggled. */
+       if ((abs(oldpts - pts) > tsync_av_threshold_min) &&
+               (timestamp_firstvpts_get() > 0)
                        /*&&*/
        /*(!get_vsync_pts_inc_mode())*//*DEBUG_TMP*/) {/* is discontinue */
                apts_discontinue = 1;