plugin: Make modules management separate per instance

There were various problems with importer loader code. One defect was that
it kept managing a single global list of available importers and marking
which one is currently used on it. This made it not work correctly for
multiple sink instances in single process and was not thread safe.

This commit changes importer loader code into a GstObject subclass, which
keeps its own list of importers per instance and unlike before makes it
possible to free this data from memory when destroyed.

Now only open modules are kept always in memory until process finishes
since we cannot unload them once loaded anyway.
This commit is contained in:
Rafał Dzięgiel
2022-05-19 18:14:07 +02:00
parent 34386bc96c
commit 8301cded2f
4 changed files with 236 additions and 222 deletions

View File

@@ -25,6 +25,7 @@
#include <gst/video/video.h>
#include "gstclapperpaintable.h"
#include "gstclapperimporterloader.h"
#include "gstclapperimporter.h"
G_BEGIN_DECLS
@@ -46,6 +47,7 @@ struct _GstClapperSink
GMutex lock;
GstClapperPaintable *paintable;
GstClapperImporterLoader *loader;
GstClapperImporter *importer;
GstVideoInfo v_info;