From 5d97ac229a9a536a2fc5c746fd8a64c805001b6a Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 27 Nov 2013 20:56:38 +0100 Subject: video: if PTS is missing, make something up using the framerate Also get rid of the PTS check _after_ filters. This means if there's a video filter which unsets PTS, no warning will be printed. But we assume that all filters are well-behaved enough by now. --- mpvcore/player/video.c | 7 ------- video/decode/dec_video.c | 10 +++++++--- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/mpvcore/player/video.c b/mpvcore/player/video.c index a9dffaf6e9..45cfd6ebf4 100644 --- a/mpvcore/player/video.c +++ b/mpvcore/player/video.c @@ -313,13 +313,6 @@ double update_video(struct MPContext *mpctx, double endpts) return 0; double pts = video_out->next_pts; - if (pts == MP_NOPTS_VALUE) { - MP_ERR(mpctx, "Video pts after filters MISSING\n"); - // Try to use decoder pts from before filters - pts = d_video->pts; - if (pts == MP_NOPTS_VALUE) - pts = d_video->last_pts; - } if (endpts == MP_NOPTS_VALUE || pts < endpts) add_frame_pts(mpctx, pts); if (mpctx->hrseek_active && pts < mpctx->hrseek_pts - .005) { diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c index 7266cdfdb6..402bb805ef 100644 --- a/video/decode/dec_video.c +++ b/video/decode/dec_video.c @@ -342,7 +342,13 @@ struct mp_image *video_decode(struct dec_video *d_video, pts = dts; // Alternative PTS determination methods - if (!opts->correct_pts) { + if (sort_pts) + pts = retrieve_sorted_pts(d_video, pts); + + if (!opts->correct_pts || pts == MP_NOPTS_VALUE) { + if (opts->correct_pts) + mp_msg(MSGT_DECVIDEO, MSGL_WARN, "No video PTS! Making something up.\n"); + double frame_time = 1.0f / (d_video->fps > 0 ? d_video->fps : 25); double base = d_video->last_packet_pdts; pts = d_video->decoded_pts; @@ -350,8 +356,6 @@ struct mp_image *video_decode(struct dec_video *d_video, pts = base == MP_NOPTS_VALUE ? 0 : base; pts += frame_time; - } else if (sort_pts) { - pts = retrieve_sorted_pts(d_video, pts); } mpi->pts = pts; -- cgit v1.2.3