# HG changeset patch # User reimar # Date 1313694906 0 # Node ID b3d3034bc162fc1a8b22514460e2239685b5b3c9 # Parent 552f50c89163035e4f7f64aff03fbfeae32d1267 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 cs binghamton edu] diff -r 552f50c89163 -r b3d3034bc162 mp_core.h --- a/mp_core.h Thu Aug 18 18:56:09 2011 +0000 +++ b/mp_core.h Thu Aug 18 19:15:06 2011 +0000 @@ -95,8 +95,6 @@ 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 diff -r 552f50c89163 -r b3d3034bc162 mplayer.c --- a/mplayer.c Thu Aug 18 18:56:09 2011 +0000 +++ b/mplayer.c Thu Aug 18 19:15:06 2011 +0000 @@ -2429,29 +2429,6 @@ 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 @@ 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 @@ { 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