video: do not compensation when paused [1/1]
authorshuanglong.wang <shuanglong.wang@amlogic.com>
Thu, 25 Apr 2019 07:37:38 +0000 (15:37 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Thu, 25 Apr 2019 10:58:54 +0000 (03:58 -0700)
PD#SWPL-5664

Problem:
pcr not paused when netflix video non-tunnel mode pause

Solution:
do not compensation when diff between omxpts and pcr too large
Because when paused, continous compensation will lead diff
beween omxpts and pcr will alway inside pcr adjust threshold,
and pcr not set again, then pcr will increase

Verify:
verify by nts

Change-Id: Ib2acea35758d161d1e9db53dd6ff369ba7973351
Signed-off-by: shuanglong.wang <shuanglong.wang@amlogic.com>
drivers/amlogic/media/video_sink/video.c

index a707054..394be7c 100644 (file)
@@ -6550,12 +6550,26 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id)
                diff = system_time - omx_pts;
                if (time_setomxpts.tv_sec > 0) {
                        struct timeval now;
-
+                       /* time_setomxpts record hwc setomxpts time, */
+                       /* when check  diff between pcr and  omx_pts, */
+                       /* add compensation will let omx_pts and pcr */
+                       /* is at the some time, more accurate. Also */
+                       /* remove the compensation when omx_pts */
+                       /* is not update for a while, in case when */
+                       /* paused, pcr is not paused */
                        do_gettimeofday(&now);
                        delta1 = (now.tv_sec - time_setomxpts.tv_sec)
                                * 1000000LL
                                + (now.tv_usec - time_setomxpts.tv_usec);
-                       diff -=  delta1 * 90 / 1000;
+                       if (((diff - omx_pts_interval_upper * 3 / 2) > 0)
+                               || ((diff - omx_pts_interval_lower * 3 / 2)
+                               < 0)) {
+                               time_setomxpts.tv_sec = 0;
+                               time_setomxpts.tv_usec = 0;
+                               pr_info("omxpts is not update for a while,do not need compenstate\n");
+                       } else {
+                               diff -=  delta1 * 90 / 1000;
+                       }
                }
 
                if ((diff - omx_pts_interval_upper) > 0