summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/omx/OMX.cpp
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2011-01-10 08:55:02 -0800
committerJames Dong <jdong@google.com>2011-01-10 08:57:50 -0800
commit14c858e80dfe2030c9f343dc0c6e2048e030731b (patch)
treef78e159783fddbf670cf2a2d1d582653adb7709c /media/libstagefright/omx/OMX.cpp
parenteb0d0c48ebfcee5e8141ae25fe42a9eac6aae230 (diff)
downloadframeworks_av-14c858e80dfe2030c9f343dc0c6e2048e030731b.zip
frameworks_av-14c858e80dfe2030c9f343dc0c6e2048e030731b.tar.gz
frameworks_av-14c858e80dfe2030c9f343dc0c6e2048e030731b.tar.bz2
Avoid deadlock in OMX::freeNode by making sure OMXCodecObserver does not hold the last reference of OMXCodec object
bug - 3336424 Change-Id: I4c79b66a900c527e3ae6a833f76d5da1b75c5a89
Diffstat (limited to 'media/libstagefright/omx/OMX.cpp')
-rw-r--r--media/libstagefright/omx/OMX.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp
index 4e9920b..3638f41 100644
--- a/media/libstagefright/omx/OMX.cpp
+++ b/media/libstagefright/omx/OMX.cpp
@@ -86,6 +86,9 @@ OMX::CallbackDispatcher::~CallbackDispatcher() {
mQueueChanged.signal();
}
+ // Don't call join on myself
+ CHECK(mThread != pthread_self());
+
void *dummy;
pthread_join(mThread, &dummy);
}
@@ -246,9 +249,12 @@ status_t OMX::freeNode(node_id node) {
status_t err = instance->freeNode(mMaster);
- index = mDispatchers.indexOfKey(node);
- CHECK(index >= 0);
- mDispatchers.removeItemsAt(index);
+ {
+ Mutex::Autolock autoLock(mLock);
+ index = mDispatchers.indexOfKey(node);
+ CHECK(index >= 0);
+ mDispatchers.removeItemsAt(index);
+ }
return err;
}