elementfactory: Handle element factory loading failure in gst_element_factory_create_valist() not as assertion

In gst_element_factory_create_with_properties() it is a normal error
path so let's keep this consistent.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3226>
This commit is contained in:
Sebastian Dröge 2022-10-19 13:33:39 +03:00 committed by GStreamer Marge Bot
parent 3ceee904dc
commit 4f03dbd37c

View file

@ -573,11 +573,14 @@ gst_element_factory_create_valist (GstElementFactory * factory,
GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
(factory)));
g_return_val_if_fail (newfactory != NULL, NULL);
g_return_val_if_fail (newfactory->type != G_TYPE_INVALID, NULL);
if (newfactory == NULL)
goto load_failed;
factory = newfactory;
if (factory->type == G_TYPE_INVALID)
goto no_type;
if (!first) {
element =
gst_element_factory_create_with_properties (factory, 0, NULL, NULL);
@ -602,6 +605,19 @@ gst_element_factory_create_valist (GstElementFactory * factory,
out:
gst_object_unref (factory);
return element;
/* ERRORS */
load_failed:
{
GST_WARNING_OBJECT (factory, "loading plugin returned NULL!");
return NULL;
}
no_type:
{
GST_WARNING_OBJECT (factory, "factory has no type");
gst_object_unref (factory);
return NULL;
}
}
/**