summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-02-28 01:26:08 +0100
committerwm4 <wm4@nowhere>2020-02-28 01:26:08 +0100
commit009d1ffda6cc5438d7287b2971d17e866ebc86c0 (patch)
tree091f36c4c1674e4cecf3265359a6a8fa2e56692f
parent3ae4094ec0eba49781ddb4eaf489fc7f0e97a237 (diff)
downloadmpv-009d1ffda6cc5438d7287b2971d17e866ebc86c0.tar.bz2
mpv-009d1ffda6cc5438d7287b2971d17e866ebc86c0.tar.xz
player: remove stale last frame references
The seeking logic saves the last video frame it has seen (for example for being able to seek to the last frame, or backstepping). Unfortunately, the frame was fed back to the filtering pipeline in situations when it shouldn't have. Then it's an out of order frame, because it really saves the last _discarded_ frame. For example, seeking to the end of a file with --keep-open, shift+up, shift+down => invalid video pts warning due to saved_frame being fed back. Explicitly discard saved_frame when it's obviously not needed anymore. The removed accesses to "r" are strictly speaking unrelated (just const-propagating them).
-rw-r--r--player/video.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/player/video.c b/player/video.c
index d8b7728fe8..3f5919a25f 100644
--- a/player/video.c
+++ b/player/video.c
@@ -522,6 +522,7 @@ static int video_output_image(struct MPContext *mpctx, bool *logical_eof)
}
mpctx->hrseek_backstep = false;
}
+ mp_image_unrefp(&mpctx->saved_frame);
add_new_frame(mpctx, img);
img = NULL;
}
@@ -529,11 +530,13 @@ static int video_output_image(struct MPContext *mpctx, bool *logical_eof)
}
}
+ if (!hrseek)
+ mp_image_unrefp(&mpctx->saved_frame);
+
// If hr-seek went past EOF, use the last frame.
- if (r <= 0 && hrseek && mpctx->saved_frame && r == VD_EOF) {
+ if (mpctx->saved_frame && r == VD_EOF) {
add_new_frame(mpctx, mpctx->saved_frame);
mpctx->saved_frame = NULL;
- r = VD_EOF;
*logical_eof = true;
}