[MPlayer-cvslog] r31311 - trunk/mplayer.c

reimar subversion at mplayerhq.hu
Thu Jun 3 22:39:41 CEST 2010


Author: reimar
Date: Thu Jun  3 22:39:41 2010
New Revision: 31311

Log:
If an invalid pts value is detected, try to to make up some if it seems
reasonable.
This avoids completely losing A-V sync e.g. when pts was not reordered correctly.
This was tested with http://samples.mplayerhq.hu/V-codecs/h264/PAFF/tv_cut.mkv
for this sample proper pts reordering is the correct solution, but more resilient
handling of the error case is still useful.

Modified:
   trunk/mplayer.c

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Thu Jun  3 19:37:58 2010	(r31310)
+++ trunk/mplayer.c	Thu Jun  3 22:39:41 2010	(r31311)
@@ -2401,8 +2401,14 @@ static double update_video(int *blit_fra
 	if (sh_video->last_pts == MP_NOPTS_VALUE)
 	    sh_video->last_pts= sh_video->pts;
 	else if (sh_video->last_pts > sh_video->pts) {
-	    sh_video->last_pts = sh_video->pts;
-	    mp_msg(MSGT_CPLAYER, MSGL_INFO, "pts value < previous\n");
+	    // make a guess whether this is some kind of discontinuity
+	    // we should jump along with or some wron timestamps we
+	    // should replace instead
+            if (sh_video->pts < sh_video->last_pts - 20 * sh_video->frametime)
+		sh_video->last_pts = sh_video->pts;
+	    else
+	        sh_video->pts = sh_video->last_pts + sh_video->frametime;
+	    mp_msg(MSGT_CPLAYER, MSGL_V, "pts value < previous\n");
 	}
 	frame_time = sh_video->pts - sh_video->last_pts;
 	sh_video->last_pts = sh_video->pts;


More information about the MPlayer-cvslog mailing list