[vlc-commits] omxil: Remove reference counting in the IOMX wrapper

Martin Storsjö git at videolan.org
Sun Oct 2 22:29:41 CEST 2011


vlc | branch: master | Martin Storsjö <martin at martin.st> | Sun Oct  2 23:06:42 2011 +0300| [e35c0b7cf02a6198506f561b24b66a39732e2d5c] | committer: 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: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e35c0b7cf02a6198506f561b24b66a39732e2d5c
---

 modules/codec/omxil/iomx.cpp |   23 +++--------------------
 1 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/modules/codec/omxil/iomx.cpp b/modules/codec/omxil/iomx.cpp
index 052a85d..2a3e8ec 100644
--- a/modules/codec/omxil/iomx.cpp
+++ b/modules/codec/omxil/iomx.cpp
@@ -44,15 +44,10 @@ using namespace android;
 class IOMXContext {
 public:
     IOMXContext() {
-        refcount = 0;
-        init_refcount = 0;
     }
 
     sp<IOMX> iomx;
     List<IOMX::ComponentInfo> components;
-    int refcount;
-
-    int init_refcount;
 };
 
 static IOMXContext *ctx;
@@ -311,26 +306,18 @@ static OMX_ERRORTYPE iomx_free_handle(OMX_HANDLETYPE handle)
 
 static OMX_ERRORTYPE iomx_init()
 {
-    if (ctx->init_refcount > 0) {
-        ctx->init_refcount++;
-        return OMX_ErrorNone;
-    }
     OMXClient client;
     if (client.connect() != OK)
         return OMX_ErrorUndefined;
 
     ctx->iomx = client.interface();
-    ctx->init_refcount = 1;
     ctx->iomx->listNodes(&ctx->components);
     return OMX_ErrorNone;
 }
 
 static OMX_ERRORTYPE iomx_deinit()
 {
-    ctx->init_refcount--;
-    if (ctx->init_refcount == 0) {
-        ctx->iomx = NULL;
-    }
+    ctx->iomx = NULL;
     return OMX_ErrorNone;
 }
 
@@ -372,18 +359,14 @@ void* iomx_dlopen(const char *)
 {
     if (!ctx)
         ctx = new IOMXContext();
-    ctx->refcount++;
     return ctx;
 }
 
 void iomx_dlclose(void *handle)
 {
     IOMXContext *ctx = (IOMXContext*) handle;
-    ctx->refcount--;
-    if (!ctx->refcount) {
-        delete ctx;
-        ::ctx = NULL;
-    }
+    delete ctx;
+    ::ctx = NULL;
 }
 
 void *iomx_dlsym(void *, const char *name)



More information about the vlc-commits mailing list