mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +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
|
GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
|
||||||
(factory)));
|
(factory)));
|
||||||
|
|
||||||
g_return_val_if_fail (newfactory != NULL, NULL);
|
if (newfactory == NULL)
|
||||||
g_return_val_if_fail (newfactory->type != G_TYPE_INVALID, NULL);
|
goto load_failed;
|
||||||
|
|
||||||
factory = newfactory;
|
factory = newfactory;
|
||||||
|
|
||||||
|
if (factory->type == G_TYPE_INVALID)
|
||||||
|
goto no_type;
|
||||||
|
|
||||||
if (!first) {
|
if (!first) {
|
||||||
element =
|
element =
|
||||||
gst_element_factory_create_with_properties (factory, 0, NULL, NULL);
|
gst_element_factory_create_with_properties (factory, 0, NULL, NULL);
|
||||||
|
@ -602,6 +605,19 @@ gst_element_factory_create_valist (GstElementFactory * factory,
|
||||||
out:
|
out:
|
||||||
gst_object_unref (factory);
|
gst_object_unref (factory);
|
||||||
return element;
|
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