gldownload: handle passthrough without a critical
authorMatthew Waters <matthew@centricular.com>
Wed, 7 Jun 2023 03:46:39 +0000 (13:46 +1000)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 8 Jun 2023 19:46:56 +0000 (19:46 +0000)
With passthrough mode, gldownload/glbasefilter may not ever retrieve a
relevant GstGLContext as it doesn't actually query the surrounding
elements.  Guard against that.

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

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

index 1951827..8d8f864 100644 (file)
@@ -1237,9 +1237,14 @@ gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt,
   (void) bclass;
 
   in_sync_meta = gst_buffer_get_gl_sync_meta (inbuf);
-  if (in_sync_meta)
-    gst_gl_sync_meta_wait (in_sync_meta, context);
-
+  if (in_sync_meta) {
+    if (context) {
+      gst_gl_sync_meta_wait (in_sync_meta, context);
+    } else if (dl->mode != GST_GL_DOWNLOAD_MODE_PASSTHROUGH) {
+      GST_WARNING_OBJECT (dl, "No configured GL context in non-passthrough "
+          "mode. Cannot wait on incoming `GstGLSyncMeta`");
+    }
+  }
 #if GST_GL_HAVE_PLATFORM_EGL && defined(HAVE_NVMM)
   if (dl->mode == GST_GL_DOWNLOAD_MODE_NVMM) {
     GstNVMMParentMeta *buf_meta = gst_buffer_get_nvmm_parent_meta (inbuf);