GNOME Bugzilla – Bug 648972
registry: add/remove functions inconsistency
Last modified: 2018-01-23 00:37:13 UTC
I don't know much about the gstregistry code, but I was writing some tests that emulate missing plugin situations and I noticed a inconsistency on the removing and adding of plugins. The attached test shows the problem. From what I understand, adding a plugin doesn't register its features automatically. I'm wondering if we shouldn't do that, or why it isn't done currently.
Created attachment 186898 [details] [review] tests: registry: Adds test to manually remove plugins from registry Adds a test that checks that removing and adding plugins manually to the registry works
If you automatically load all plugins that are added to the registry you will always load all plugins that exist on the system and not only the ones that are currently needed.
If I understand correctly, the plugins have features, and at least the features names need to be put into the feature -> plugin map, so they can be found from gst_element_factory_make for example.
Yes that would make sense but gst_plugin_load() should be prevented
So how do we want to proceed here? :)
Thiago?
The problem persists in 1.0. The issue is that gst_registry_remove_plugin removes the plugin and its associated features, but gst_registry_add_plugin just adds the plugin without reloading the features. So the remove/add pair is a bit asymmetric. I'm not sure how (and if we want) to fix this. I haven't touched gstregistry code ever, so I don't know the details. The use case I had was for testing behavior of camerabin when some elements were missing. IMHO we should at least mention at the _add_plugin documentation mention that it won't automatically add the plugin features back and maybe add an explicit function for loading the plugin features, as the GstPlugin is opaque and gives the user no access to GstPluginDesc that has the init function pointer.
Yes, at least document it. IMHO these should be symmetric but doing that without breaking (or only minimally breaking) backwards compat needs some discussions :)
Closing this to reduce clutter in bugzilla. Not sure if we really need to do anything here. _add_plugin() is usually called internally by GStreamer. Feel free to improve the docs as proposed, or re-open :)