summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/omx
diff options
context:
space:
mode:
authorIliyan Malchev <malchev@google.com>2011-07-27 00:58:25 -0700
committerIliyan Malchev <malchev@google.com>2011-07-27 10:03:43 -0700
commit673aebfc7e6e8d38ad29a66d68c71ea8e9121eb1 (patch)
treea8511c0871c6b059d1853eb95054c5797ba11d6e /media/libstagefright/omx
parent85fb61eb8b39d4d3fcebc796c3f7ade1d58567aa (diff)
downloadframeworks_av-673aebfc7e6e8d38ad29a66d68c71ea8e9121eb1.zip
frameworks_av-673aebfc7e6e8d38ad29a66d68c71ea8e9121eb1.tar.gz
frameworks_av-673aebfc7e6e8d38ad29a66d68c71ea8e9121eb1.tar.bz2
libstagefright: add destroyOMXPlugin and use C linkage for symbols
Add a destroyOMXPlugin() to complemenet createOMXPlugin(). Since the latter is an opaque call into a library, it is not safe to assume that the object thus returned may be destroyed by calling delete. This patch will call destroyOMXPlugin() in libstagefrighthw.so, if the symbol is defined there. Otherwise, it will default to a delete as before. Also, prefer C linkage for the symbol names. Using mangled C++ symbols is not very safe and makes it hard to grep for those symbols through the code. We attempt to locate createOMXPlugin as a C symbol then try it as a mangled C++ one. We only use C linkage for destroyOMXPlugin since this symbol is new. Change-Id: Ied23c910486856a0f18056df049c871234797c5c Signed-off-by: Iliyan Malchev <malchev@google.com>
Diffstat (limited to 'media/libstagefright/omx')
-rw-r--r--media/libstagefright/omx/OMXMaster.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/media/libstagefright/omx/OMXMaster.cpp b/media/libstagefright/omx/OMXMaster.cpp
index 504d470..c8278ab 100644
--- a/media/libstagefright/omx/OMXMaster.cpp
+++ b/media/libstagefright/omx/OMXMaster.cpp
@@ -57,6 +57,9 @@ void OMXMaster::addPlugin(const char *libname) {
typedef OMXPluginBase *(*CreateOMXPluginFunc)();
CreateOMXPluginFunc createOMXPlugin =
(CreateOMXPluginFunc)dlsym(
+ mVendorLibHandle, "createOMXPlugin");
+ if (!createOMXPlugin)
+ createOMXPlugin = (CreateOMXPluginFunc)dlsym(
mVendorLibHandle, "_ZN7android15createOMXPluginEv");
if (createOMXPlugin) {
@@ -96,11 +99,19 @@ void OMXMaster::addPlugin(OMXPluginBase *plugin) {
void OMXMaster::clearPlugins() {
Mutex::Autolock autoLock(mLock);
+ typedef void (*DestroyOMXPluginFunc)(OMXPluginBase*);
+ DestroyOMXPluginFunc destroyOMXPlugin =
+ (DestroyOMXPluginFunc)dlsym(
+ mVendorLibHandle, "destroyOMXPlugin");
+
mPluginByComponentName.clear();
for (List<OMXPluginBase *>::iterator it = mPlugins.begin();
- it != mPlugins.end(); ++it) {
- delete *it;
+ it != mPlugins.end(); ++it) {
+ if (destroyOMXPlugin)
+ destroyOMXPlugin(*it);
+ else
+ delete *it;
*it = NULL;
}