urisourcebin: Error out if a source doesn't expose pads
authorEdward Hervey <edward@centricular.com>
Wed, 19 Oct 2022 09:00:09 +0000 (11:00 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 16 Nov 2022 14:01:46 +0000 (14:01 +0000)
Looks like this fell through the cracks. If a source element doesn't have
dynamic pads and doesn't provide any source pad ... we should properly error
out.

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

subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c

index 9161a07..abbad53 100644 (file)
@@ -2321,11 +2321,9 @@ setup_source (GstURISourceBin * urisrc)
        * no_more pads because we are done. */
       gst_element_no_more_pads (GST_ELEMENT_CAST (urisrc));
       return TRUE;
-    } else if (!have_out) {
-      GST_DEBUG_OBJECT (urisrc, "Source has no output pads");
-
-      return TRUE;
     }
+    if (!have_out)
+      goto no_pads;
   } else {
     GST_DEBUG_OBJECT (urisrc, "Source has dynamic output pads");
     /* connect a handler for the new-pad signal */
@@ -2392,6 +2390,12 @@ invalid_source:
         (_("Source element is invalid.")), (NULL));
     return FALSE;
   }
+no_pads:
+  {
+    GST_ELEMENT_ERROR (urisrc, CORE, FAILED,
+        (_("Source element has no pads.")), (NULL));
+    return FALSE;
+  }
 streaming_failed:
   {
     /* message was posted */