element: When requesting an existing pad print a g_critical() instead of using an...
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 1 Apr 2011 11:56:09 +0000 (13:56 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 1 Apr 2011 11:58:43 +0000 (13:58 +0200)
Some applications are requesting the same pad name multiple times
and the behaviour is undefined and different from element to element
but we don't want to break applications that work just fine.

In 0.11 this check should be an assertion again, although elements
have to do manual checking if the pad already exists again because
it can't be done in a threadsafe way here.

gst/gstelement.c

index 1b37cfd..3133da5 100644 (file)
@@ -1021,9 +1021,13 @@ _gst_element_request_pad (GstElement * element, GstPadTemplate * templ,
     }
 
     pad = gst_element_get_static_pad (element, name);
-    if (pad)
+    if (pad) {
       gst_object_unref (pad);
-    g_return_val_if_fail (pad == NULL, NULL);
+      /* FIXME 0.11: Change this to g_return_val_if_fail() */
+      g_critical ("Element %s already has a pad named %s, the behaviour of "
+          " gst_element_get_request_pad() for existing pads is undefined!",
+          GST_ELEMENT_NAME (element), name);
+    }
   }
 #endif