Commit e35c0b7c authored by Martin Storsjö's avatar Martin Storsjö Committed by Jean-Baptiste Kempf

omxil: Remove reference counting in the IOMX wrapper

This is no longer necessary now, when the omxil module keeps
track of the number of initializations of the OMX Core.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent d50f38f9
...@@ -44,15 +44,10 @@ using namespace android; ...@@ -44,15 +44,10 @@ using namespace android;
class IOMXContext { class IOMXContext {
public: public:
IOMXContext() { IOMXContext() {
refcount = 0;
init_refcount = 0;
} }
sp<IOMX> iomx; sp<IOMX> iomx;
List<IOMX::ComponentInfo> components; List<IOMX::ComponentInfo> components;
int refcount;
int init_refcount;
}; };
static IOMXContext *ctx; static IOMXContext *ctx;
...@@ -311,26 +306,18 @@ static OMX_ERRORTYPE iomx_free_handle(OMX_HANDLETYPE handle) ...@@ -311,26 +306,18 @@ static OMX_ERRORTYPE iomx_free_handle(OMX_HANDLETYPE handle)
static OMX_ERRORTYPE iomx_init() static OMX_ERRORTYPE iomx_init()
{ {
if (ctx->init_refcount > 0) {
ctx->init_refcount++;
return OMX_ErrorNone;
}
OMXClient client; OMXClient client;
if (client.connect() != OK) if (client.connect() != OK)
return OMX_ErrorUndefined; return OMX_ErrorUndefined;
ctx->iomx = client.interface(); ctx->iomx = client.interface();
ctx->init_refcount = 1;
ctx->iomx->listNodes(&ctx->components); ctx->iomx->listNodes(&ctx->components);
return OMX_ErrorNone; return OMX_ErrorNone;
} }
static OMX_ERRORTYPE iomx_deinit() static OMX_ERRORTYPE iomx_deinit()
{ {
ctx->init_refcount--; ctx->iomx = NULL;
if (ctx->init_refcount == 0) {
ctx->iomx = NULL;
}
return OMX_ErrorNone; return OMX_ErrorNone;
} }
...@@ -372,18 +359,14 @@ void* iomx_dlopen(const char *) ...@@ -372,18 +359,14 @@ void* iomx_dlopen(const char *)
{ {
if (!ctx) if (!ctx)
ctx = new IOMXContext(); ctx = new IOMXContext();
ctx->refcount++;
return ctx; return ctx;
} }
void iomx_dlclose(void *handle) void iomx_dlclose(void *handle)
{ {
IOMXContext *ctx = (IOMXContext*) handle; IOMXContext *ctx = (IOMXContext*) handle;
ctx->refcount--; delete ctx;
if (!ctx->refcount) { ::ctx = NULL;
delete ctx;
::ctx = NULL;
}
} }
void *iomx_dlsym(void *, const char *name) void *iomx_dlsym(void *, const char *name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment