summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Migliori <sgerwk@aol.com>2018-02-08 11:55:22 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-02-11 17:51:15 -0800
commit733bcc03f62009e8cf27c95df1c7d643724df108 (patch)
tree012c42c6f8aff3131e87c599a87f8a334b99619b
parent3a2bc158bb0988af0024014a7a39d6f5c943b6be (diff)
downloadmpv-733bcc03f62009e8cf27c95df1c7d643724df108.tar.bz2
mpv-733bcc03f62009e8cf27c95df1c7d643724df108.tar.xz
vo_drm: reset last input image on reconfig
The last image is stored in vo->priv->last_input to be used when redrawing a frame is necessary (control: VOCTRL_REDRAW_FRAME). At the beginning it is NULL, so a redraw request has no effect since draw_image ignores calls with image=NULL. When using --force-window the size of the image may change without the vo structure being re-created. Before this commit, the size of vo->priv->last_input could become inconsistent with the cropping rectangle vo->priv->src_rc, which could trigger an assert in mp_image_crop_rc(). Even if it did not, the last image of a video remained on the screen when the next file in the playlist had no video (e.g., it was an mp3 without an embedded cover). This commit deallocates and resets to NULL the image vo->priv->last_input when reconfiguring video.
-rw-r--r--video/out/vo_drm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/video/out/vo_drm.c b/video/out/vo_drm.c
index 07cd1a53a6..8262fce88d 100644
--- a/video/out/vo_drm.c
+++ b/video/out/vo_drm.c
@@ -295,6 +295,9 @@ static int reconfig(struct vo *vo, struct mp_image_params *params)
p->cur_frame_cropped = mp_image_new_dummy_ref(p->cur_frame);
mp_image_crop_rc(p->cur_frame_cropped, p->dst);
+ talloc_free(p->last_input);
+ p->last_input = NULL;
+
struct framebuffer *buf = p->bufs;
for (unsigned int i = 0; i < BUF_COUNT; i++)
memset(buf[i].map, 0, buf[i].size);