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.
This commit is contained in:
Marco Migliori 2018-02-08 11:55:22 +01:00 committed by Kevin Mitchell
parent 3a2bc158bb
commit 733bcc03f6
1 changed files with 3 additions and 0 deletions

View File

@ -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);