diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c index 25ade0e11f..39ba1110ce 100644 --- a/ext/gl/gstglimagesink.c +++ b/ext/gl/gstglimagesink.c @@ -993,11 +993,8 @@ _ensure_gl_setup (GstGLImageSink * gl_sink) g_signal_connect (window, "mouse-event", G_CALLBACK (gst_glimage_sink_mouse_event_cb), gl_sink); - if (gl_sink->x >= 0 && gl_sink->y >= 0 && gl_sink->width > 0 && - gl_sink->height > 0) { - gst_gl_window_set_render_rectangle (window, gl_sink->x, gl_sink->y, - gl_sink->width, gl_sink->height); - } + gst_gl_window_set_render_rectangle (window, gl_sink->x, gl_sink->y, + gl_sink->width, gl_sink->height); if (other_context) gst_object_unref (other_context); diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c index 00ccf665e8..0889e6afee 100644 --- a/gst-libs/gst/gl/gstglwindow.c +++ b/gst-libs/gst/gl/gstglwindow.c @@ -907,6 +907,13 @@ gst_gl_window_set_render_rectangle (GstGLWindow * window, gint x, gint y, g_return_val_if_fail (GST_IS_GL_WINDOW (window), FALSE); window_class = GST_GL_WINDOW_GET_CLASS (window); + /* When x/y is smaller then reset the render rectangle */ + if (x < 0 || y < 0) { + x = y = 0; + width = window->priv->surface_width; + height = window->priv->surface_height; + } + if (x < 0 || y < 0 || width <= 0 || height <= 0) return FALSE;