summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-06-03 20:59:40 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-06-03 20:59:40 +0000
commit82aabb77d39ab0c2042da61bcc67c7735841f2bc (patch)
treebeb35fcf5e0c7fe82a488c8bef0998781e1864bb /libmpcodecs
parent9343d1cb2d6b01e5c08a6a82f5b2c43d251c868e (diff)
downloadmpv-82aabb77d39ab0c2042da61bcc67c7735841f2bc.tar.bz2
mpv-82aabb77d39ab0c2042da61bcc67c7735841f2bc.tar.xz
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. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31312 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/dec_video.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c
index 51da1adf7b..1dd6e42313 100644
--- a/libmpcodecs/dec_video.c
+++ b/libmpcodecs/dec_video.c
@@ -394,20 +394,6 @@ void *decode_video(sh_video_t *sh_video, unsigned char *start, int in_size,
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, unsigned char *start, int in_size,
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, unsigned char *start, int in_size,
"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;
}