From 7bba97b301c732fb1eb4dad891d00c947d2f6363 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 18 Aug 2016 20:37:25 +0200 Subject: video: don't discard video frames after endpts Instead of letting it keep decoding by trying to find a new frame, "plug" the frame queue by not removing it. (Or actually, by putting it back instead of discarding it.) Matters for seamless looping (following commits), and possibly some other corner cases. The added function vf_unread_output_frame() is a bit of a sin, but still reasonable, since its implementation is trivial. --- player/video.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'player/video.c') diff --git a/player/video.c b/player/video.c index 23f8eefa33..6373123407 100644 --- a/player/video.c +++ b/player/video.c @@ -840,9 +840,11 @@ static int video_output_image(struct MPContext *mpctx) struct mp_image *img = vf_read_output_frame(vo_c->vf); if (img) { double endpts = get_play_end_pts(mpctx); - if (endpts != MP_NOPTS_VALUE && img->pts >= endpts) { - r = VD_EOF; - } else if (mpctx->max_frames == 0) { + if ((endpts != MP_NOPTS_VALUE && img->pts >= endpts) || + mpctx->max_frames == 0) + { + vf_unread_output_frame(vo_c->vf, img); + img = NULL; r = VD_EOF; } else if (hrseek && mpctx->hrseek_lastframe) { mp_image_setrefp(&mpctx->saved_frame, img); -- cgit v1.2.3