wayland/wlbuffer: just return if used_by_compositor is true when attach
authorHaihua Hu <jared.hu@nxp.com>
Thu, 18 Oct 2018 05:35:04 +0000 (13:35 +0800)
committerTim-Philipp Müller <tim@centricular.com>
Thu, 8 Aug 2019 23:12:53 +0000 (00:12 +0100)
When buffer is used by compositor, we don't need attach it and hold one
more reference. Just check used_by_compositor, just return if it is true.
Assert error log is not need, this is normal behavior.

ext/wayland/wlbuffer.c

index 4ac99ef4b0b6a5931cce8f33dcccc18ef8adfdc0..21214604ff5e1c4866632131d2d70e42e43e4ffd 100644 (file)
@@ -220,7 +220,10 @@ gst_wl_buffer_force_release_and_unref (GstWlBuffer * self)
 void
 gst_wl_buffer_attach (GstWlBuffer * self, struct wl_surface *surface)
 {
-  g_return_if_fail (self->used_by_compositor == FALSE);
+  if (self->used_by_compositor) {
+    GST_DEBUG_OBJECT (self, "buffer used by compositor %p", self->gstbuffer);
+    return;
+  }
 
   wl_surface_attach (surface, self->wlbuffer, 0, 0);