1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-18 17:40:30 +00:00

vo_dmabuf_wayland: update the image of pending buffers

When using a display-* video-sync mode, it is possible for buffers with
a matching id to already have an image associated with them (i.e. the
compositor hasn't released it yet). Previously, it was thought that we
could just unref, return null, and make a new buffer but this eventually
leads to a fatal error that originates from libwayland itself which
stops playback. Admittedly, the reason for the error is a bit nebulous
but likely it seems to be some kind of mismatch between dmabuf params
and the associated image with the buffer.

However, we can simplify this process greatly. Instead when the
previously mentioned edge case happens, the old image can simply be
freed and we give the buffer the new image. This saves creating a new
buffer and also avoids that nasty libwayland error. A nice win-win all
around. Fixes #11773.
This commit is contained in:
Dudemanguy 2023-06-14 12:21:10 -05:00
parent 4d4837b84e
commit f5e828ac25

View File

@ -219,14 +219,10 @@ static struct buffer *buffer_check(struct vo *vo, struct mp_image *src)
struct buffer *buf;
wl_list_for_each(buf, &p->buffer_list, link) {
if (buf->id == id) {
if (buf->image) {
if (buf->image)
mp_image_unrefp(&buf->image);
buf->image = NULL;
goto done;
} else {
buf->image = src;
return buf;
}
buf->image = src;
return buf;
}
}