element: When requesting an existing pad print a g_critical() instead of using an assertion

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.
This commit is contained in:
Sebastian Dröge 2011-04-01 13:56:09 +02:00
parent 9f3e48b55b
commit 38c07bac1d

View 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