From b4bdb75a800fb615ca20739ae8444b9b094a2b26 Mon Sep 17 00:00:00 2001 From: David Bender Date: Fri, 12 Jun 2020 00:21:56 +0200 Subject: [PATCH] gstglwindow_x11: fix resize This patch was taken from #629#note_178766, the comment made at the time was: The root issue is a mismatch between the initialization of render_rect in GstGLWindowX11Private and what's expected in the draw_cb function. Because render_rect is not explicitly initialized to a width and height of -1 (unlike gstglwindow_wayland_egl.c which does initialize to -1), the less-than check for explicitly-set render_rect at gstglwindow_x11.c:453-454 always fails, even when the parent_win has been set and the render rectangle has never been set. Maybe this came from copying the similar check in the wayland code? Regardless, I think the correct inequality should be '<= 0' (on both lines). Alternatively initialization could be changed, but other sinks, e.g. xvimagesink don't appear to use -1 to mean "unset" render_rect this way. The issue can be reproduced by running the example in tests/examples/gl/qt/videooverlay/ on X11, and resizing the output window Part-of: --- gst-libs/gst/gl/x11/gstglwindow_x11.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c index 5cbf46a6b1..960d39fb81 100644 --- a/gst-libs/gst/gl/x11/gstglwindow_x11.c +++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c @@ -450,8 +450,8 @@ draw_cb (gpointer data) GST_TRACE_OBJECT (window, "window size %ux%u", attr.width, attr.height); if (window_x11->parent_win && - (window_x11->priv->render_rect.w < 0 || - window_x11->priv->render_rect.h < 0)) { + (window_x11->priv->render_rect.w <= 0 || + window_x11->priv->render_rect.h <= 0)) { XWindowAttributes attr_parent; XGetWindowAttributes (window_x11->device, window_x11->parent_win, &attr_parent);