summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-05-24 15:58:09 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-05-24 15:58:09 -0700
commit931db87f8fd6fa1fd5b918f3b1fc107e8dca2e0e (patch)
treee4b0ad37a5596a86f80e4237ba1c1c4831d51030 /media
parent90d99759c4607106adcf1dbcc8546aedb2ff089f (diff)
parent5a65e30064dc8dffa4f3d868f1c46038972c40c5 (diff)
downloadframeworks_av-931db87f8fd6fa1fd5b918f3b1fc107e8dca2e0e.zip
frameworks_av-931db87f8fd6fa1fd5b918f3b1fc107e8dca2e0e.tar.gz
frameworks_av-931db87f8fd6fa1fd5b918f3b1fc107e8dca2e0e.tar.bz2
Merge "Make sure all references to the decoder plugin are accounted for"
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/include/SimpleSoftOMXComponent.h2
-rw-r--r--media/libstagefright/include/SoftOMXComponent.h2
-rw-r--r--media/libstagefright/omx/SimpleSoftOMXComponent.cpp6
-rw-r--r--media/libstagefright/omx/SoftOMXPlugin.cpp2
4 files changed, 10 insertions, 2 deletions
diff --git a/media/libstagefright/include/SimpleSoftOMXComponent.h b/media/libstagefright/include/SimpleSoftOMXComponent.h
index 2a29a7d..50cd275 100644
--- a/media/libstagefright/include/SimpleSoftOMXComponent.h
+++ b/media/libstagefright/include/SimpleSoftOMXComponent.h
@@ -36,7 +36,7 @@ struct SimpleSoftOMXComponent : public SoftOMXComponent {
OMX_PTR appData,
OMX_COMPONENTTYPE **component);
- virtual ~SimpleSoftOMXComponent();
+ virtual void prepareForDestruction();
void onMessageReceived(const sp<AMessage> &msg);
diff --git a/media/libstagefright/include/SoftOMXComponent.h b/media/libstagefright/include/SoftOMXComponent.h
index 053bc22..a808611 100644
--- a/media/libstagefright/include/SoftOMXComponent.h
+++ b/media/libstagefright/include/SoftOMXComponent.h
@@ -38,6 +38,8 @@ struct SoftOMXComponent : public RefBase {
void setLibHandle(void *libHandle);
void *libHandle() const;
+ virtual void prepareForDestruction() {}
+
protected:
virtual ~SoftOMXComponent();
diff --git a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
index 179b2a0..f7330f3 100644
--- a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
+++ b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
@@ -45,7 +45,11 @@ SimpleSoftOMXComponent::SimpleSoftOMXComponent(
PRIORITY_AUDIO);
}
-SimpleSoftOMXComponent::~SimpleSoftOMXComponent() {
+void SimpleSoftOMXComponent::prepareForDestruction() {
+ // The looper's queue may still contain messages referencing this
+ // object. Make sure those are flushed before returning so that
+ // a subsequent dlunload() does not pull out the rug from under us.
+
mLooper->unregisterHandler(mHandler->id());
mLooper->stop();
}
diff --git a/media/libstagefright/omx/SoftOMXPlugin.cpp b/media/libstagefright/omx/SoftOMXPlugin.cpp
index cfbcb96..04ca39e 100644
--- a/media/libstagefright/omx/SoftOMXPlugin.cpp
+++ b/media/libstagefright/omx/SoftOMXPlugin.cpp
@@ -127,6 +127,8 @@ OMX_ERRORTYPE SoftOMXPlugin::destroyComponentInstance(
(SoftOMXComponent *)
((OMX_COMPONENTTYPE *)component)->pComponentPrivate;
+ me->prepareForDestruction();
+
void *libHandle = me->libHandle();
CHECK_EQ(me->getStrongCount(), 1);