[MPlayer-cvslog] r31312 - trunk/libmpcodecs/dec_video.c

reimar subversion at mplayerhq.hu
Thu Jun 3 22:59:40 CEST 2010


Author: reimar
Date: Thu Jun  3 22:59:40 2010
New Revision: 31312

Log:
Limit buffered PTS only when we actually got a frame from the decoder.
This avoids some issues with H.264 PAFF due to dropping PTS values too
early because only every second packet actually produced output.
Just keeping up to one additional pts value would have avoided this
particular issue as well, but this is more generic.

Modified:
   trunk/libmpcodecs/dec_video.c

Modified: trunk/libmpcodecs/dec_video.c
==============================================================================
--- trunk/libmpcodecs/dec_video.c	Thu Jun  3 22:39:41 2010	(r31311)
+++ trunk/libmpcodecs/dec_video.c	Thu Jun  3 22:59:40 2010	(r31312)
@@ -394,20 +394,6 @@ void *decode_video(sh_video_t *sh_video,
     double tt;
 
     if (correct_pts && pts != MP_NOPTS_VALUE) {
-        int delay = get_current_video_decoder_lag(sh_video);
-        if (delay >= 0) {
-            if (delay > sh_video->num_buffered_pts)
-#if 0
-                // this is disabled because vd_ffmpeg reports the same lag
-                // after seek even when there are no buffered frames,
-                // leading to incorrect error messages
-                mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Not enough buffered pts\n");
-#else
-                ;
-#endif
-            else
-                sh_video->num_buffered_pts = delay;
-        }
         if (sh_video->num_buffered_pts ==
             sizeof(sh_video->buffered_pts) / sizeof(double))
             mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Too many buffered pts\n");
@@ -451,6 +437,7 @@ void *decode_video(sh_video_t *sh_video,
         mpi->fields &= ~MP_IMGFIELD_TOP_FIRST;
 
     if (correct_pts) {
+        int delay = get_current_video_decoder_lag(sh_video);
         if (sh_video->num_buffered_pts) {
             sh_video->num_buffered_pts--;
             sh_video->pts = sh_video->buffered_pts[sh_video->num_buffered_pts];
@@ -459,6 +446,22 @@ void *decode_video(sh_video_t *sh_video,
                    "No pts value from demuxer to " "use for frame!\n");
             sh_video->pts = MP_NOPTS_VALUE;
         }
+        if (delay >= 0) {
+            // limit buffered pts only afterwards so we do not get confused
+            // by packets that produce no output (e.g. a single field of a
+            // H.264 frame).
+            if (delay > sh_video->num_buffered_pts)
+#if 0
+                // this is disabled because vd_ffmpeg reports the same lag
+                // after seek even when there are no buffered frames,
+                // leading to incorrect error messages
+                mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Not enough buffered pts\n");
+#else
+                ;
+#endif
+            else
+                sh_video->num_buffered_pts = delay;
+        }
     }
     return mpi;
 }


More information about the MPlayer-cvslog mailing list