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.
This commit is contained in:
wm4 2015-03-18 22:26:49 +01:00
parent 39ed9b7d96
commit 47c131bb0c
2 changed files with 9 additions and 13 deletions

View File

@ -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[0] = mpctx->next_frame[1];
mpctx->next_frame[1] = NULL; mpctx->next_frame[1] = NULL;
double frame_time = 0;
double pts = mpctx->next_frame[0]->pts; double pts = mpctx->next_frame[0]->pts;
double last_pts = mpctx->video_pts; if (mpctx->video_pts != MP_NOPTS_VALUE) {
if (last_pts == MP_NOPTS_VALUE) frame_time = pts - mpctx->video_pts;
last_pts = pts; if (frame_time <= 0 || frame_time >= 60) {
double frame_time = pts - last_pts; // Assume a PTS difference >= 60 seconds is a discontinuity.
if (frame_time < 0 || frame_time >= 60) { MP_WARN(mpctx, "Non-monotonic video pts: %f -> %f\n",
// Assume a PTS difference >= 60 seconds is a discontinuity. mpctx->video_pts, pts);
MP_WARN(mpctx, "Jump in video pts: %f -> %f\n", last_pts, pts); frame_time = 0;
frame_time = 0; }
} }
mpctx->video_next_pts = pts; mpctx->video_next_pts = pts;
mpctx->delay -= frame_time; mpctx->delay -= frame_time;

View File

@ -363,11 +363,6 @@ struct mp_image *video_decode(struct dec_video *d_video,
pts += frame_time; 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) if (d_video->has_broken_packet_pts < 0)
d_video->has_broken_packet_pts++; d_video->has_broken_packet_pts++;
if (d_video->num_codec_pts_problems || pkt_pts == MP_NOPTS_VALUE) if (d_video->num_codec_pts_problems || pkt_pts == MP_NOPTS_VALUE)