glimagesink: Fix render rect assertion
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Fri, 25 Nov 2022 15:01:06 +0000 (10:01 -0500)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 28 Nov 2022 07:52:25 +0000 (07:52 +0000)
Whenever the surface is resized before the stream is negotiated, we endup
with an assertion in libgstvideo.

  gst_video_center_rect: assertion 'src->h != 0' failed

This fixes it, by following the style aready in place, which is to ensure
surfaces have a minimum size of 1x1.

Fixes #1139

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3467>

subprojects/gst-plugins-base/ext/gl/gstglimagesink.c

index b6ee5de..bf0ee8b 100644 (file)
@@ -2298,6 +2298,10 @@ gst_glimage_sink_on_resize (GstGLImageSink * gl_sink, gint width, gint height)
         src.h = GST_VIDEO_SINK_HEIGHT (gl_sink);
       }
 
+      /* The stream may not be negotiated yet */
+      src.w = MAX (1, src.w);
+      src.h = MAX (1, src.h);
+
       dst.x = 0;
       dst.y = 0;
       dst.w = width;