From 47c131bb0c3240df6a9677684d50c96226b54772 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 18 Mar 2015 22:26:49 +0100 Subject: player: warn against non-monotonic video PTS only once For some reason there were two points in the code where it warned against non-monotonic video PTS. The one in video.c triggered on PTS going backwards or making large jumps forwards, while dec_video.c triggered on PTS going backwards or PTS not changing. Merge them into a single check, which warns against all cases. --- player/video.c | 17 +++++++++-------- video/decode/dec_video.c | 5 ----- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/player/video.c b/player/video.c index 53404a2a20..e072de7c99 100644 --- a/player/video.c +++ b/player/video.c @@ -581,15 +581,16 @@ static int video_output_image(struct MPContext *mpctx, double endpts) mpctx->next_frame[0] = mpctx->next_frame[1]; mpctx->next_frame[1] = NULL; + double frame_time = 0; double pts = mpctx->next_frame[0]->pts; - double last_pts = mpctx->video_pts; - if (last_pts == MP_NOPTS_VALUE) - last_pts = pts; - double frame_time = pts - last_pts; - if (frame_time < 0 || frame_time >= 60) { - // Assume a PTS difference >= 60 seconds is a discontinuity. - MP_WARN(mpctx, "Jump in video pts: %f -> %f\n", last_pts, pts); - frame_time = 0; + if (mpctx->video_pts != MP_NOPTS_VALUE) { + frame_time = pts - mpctx->video_pts; + if (frame_time <= 0 || frame_time >= 60) { + // Assume a PTS difference >= 60 seconds is a discontinuity. + MP_WARN(mpctx, "Non-monotonic video pts: %f -> %f\n", + mpctx->video_pts, pts); + frame_time = 0; + } } mpctx->video_next_pts = pts; mpctx->delay -= frame_time; diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c index 5687abcb7d..a0bd6cb047 100644 --- a/video/decode/dec_video.c +++ b/video/decode/dec_video.c @@ -363,11 +363,6 @@ struct mp_image *video_decode(struct dec_video *d_video, pts += frame_time; } - if (d_video->decoded_pts != MP_NOPTS_VALUE && pts <= d_video->decoded_pts) { - MP_WARN(d_video, "Non-monotonic video pts: %f <= %f\n", - pts, d_video->decoded_pts); - } - if (d_video->has_broken_packet_pts < 0) d_video->has_broken_packet_pts++; if (d_video->num_codec_pts_problems || pkt_pts == MP_NOPTS_VALUE) -- cgit v1.2.3