[MPlayer-cvslog] r34000 - in trunk: mp_core.h mplayer.c

reimar subversion at mplayerhq.hu
Thu Aug 18 21:15:07 CEST 2011


Author: reimar
Date: Thu Aug 18 21:15:06 2011
New Revision: 34000

Log:
Remove strange pts locking code that would never really result in good
A-V sync and actually break it quite seriously in some cases
(Reportedly NTSC DVDs with pullup under high CPU load?)

Patch by Steaphan Greene [sgreene <at> cs binghamton edu]

Modified:
   trunk/mp_core.h
   trunk/mplayer.c

Modified: trunk/mp_core.h
==============================================================================
--- trunk/mp_core.h	Thu Aug 18 20:56:09 2011	(r33999)
+++ trunk/mp_core.h	Thu Aug 18 21:15:06 2011	(r34000)
@@ -95,8 +95,6 @@ typedef struct MPContext {
     int startup_decode_retry;
     // how long until we need to display the "current" frame
     float time_frame;
-    // flag to indicate that we've found a correctly timed video frame PTS
-    int framestep_found;
 
     // AV sync: the next frame should be shown when the audio out has this
     // much (in seconds) buffered data left. Increased when more data is

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Thu Aug 18 20:56:09 2011	(r33999)
+++ trunk/mplayer.c	Thu Aug 18 21:15:06 2011	(r34000)
@@ -2429,29 +2429,6 @@ static double update_video(int *blit_fra
 
             if (full_frame) {
                 sh_video->timer += frame_time;
-
-                // Time-based PTS recalculation.
-                // The key to maintaining A-V sync is to not touch PTS until the proper frame is reached
-                if (sh_video->pts != MP_NOPTS_VALUE) {
-                    if (sh_video->last_pts != MP_NOPTS_VALUE) {
-                        double pts     = sh_video->last_pts + frame_time;
-                        double ptsdiff = fabs(pts - sh_video->pts);
-
-                        // Allow starting PTS recalculation at the appropriate frame only
-                        mpctx->framestep_found |= (ptsdiff <= frame_time * 1.5);
-
-                        // replace PTS only if we're not too close and not too far
-                        // and a correctly timed frame has been found, otherwise
-                        // keep pts to eliminate rounding errors or catch up with stream
-                        if (ptsdiff > frame_time * 20)
-                            mpctx->framestep_found = 0;
-                        if (ptsdiff * 10 > frame_time && mpctx->framestep_found)
-                            sh_video->pts = pts;
-                        else
-                            mp_dbg(MSGT_AVSYNC, MSGL_DBG2, "Keeping PTS at %6.2f\n", sh_video->pts);
-                    }
-                    sh_video->last_pts = sh_video->pts;
-                }
                 if (mpctx->sh_audio)
                     mpctx->delay -= frame_time;
                 // video_read_frame can change fps (e.g. for ASF video)
@@ -2695,7 +2672,6 @@ static int seek(MPContext *mpctx, double
         mpctx->num_buffered_frames = 0;
         mpctx->delay           = 0;
         mpctx->time_frame      = 0;
-        mpctx->framestep_found = 0;
         // Not all demuxers set d_video->pts during seek, so this value
         // (which is used by at least vobsub and edl code below) may
         // be completely wrong (probably 0).
@@ -3596,7 +3572,6 @@ goto_enable_cache:
 
     {
         mpctx->num_buffered_frames = 0;
-        mpctx->framestep_found     = 0;
 
         // Make sure old OSD does not stay around,
         // e.g. with -fixed-vo and same-resolution files


More information about the MPlayer-cvslog mailing list