summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-06-14 12:21:10 -0500
committerDudemanguy <random342@airmail.cc>2023-06-14 12:21:10 -0500
commitf5e828ac25e6776f52c618cfedde481814c4d947 (patch)
tree48cf80eca6f73170e5ef19aecbf73033221efdd8 /video
parent4d4837b84e70518cc99a02e545986e0343de3714 (diff)
downloadmpv-f5e828ac25e6776f52c618cfedde481814c4d947.tar.bz2
mpv-f5e828ac25e6776f52c618cfedde481814c4d947.tar.xz
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.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo_dmabuf_wayland.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/video/out/vo_dmabuf_wayland.c b/video/out/vo_dmabuf_wayland.c
index 1536d6a0c9..f57e6f27ba 100644
--- a/video/out/vo_dmabuf_wayland.c
+++ b/video/out/vo_dmabuf_wayland.c
@@ -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;
}
}