mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
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:
parent
3ceee904dc
commit
4f03dbd37c
1 changed files with 18 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue