summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/OMXCodec.cpp4
-rw-r--r--media/libstagefright/omx/OMX.cpp12
2 files changed, 11 insertions, 5 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 980da77..b5d00bf 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -234,7 +234,9 @@ struct OMXCodecObserver : public BnOMXObserver {
sp<OMXCodec> codec = mTarget.promote();
if (codec.get() != NULL) {
+ Mutex::Autolock autoLock(codec->mLock);
codec->on_message(msg);
+ codec.clear();
}
}
@@ -1672,8 +1674,6 @@ status_t OMXCodec::allocateBuffersOnPort(OMX_U32 portIndex) {
}
void OMXCodec::on_message(const omx_message &msg) {
- Mutex::Autolock autoLock(mLock);
-
switch (msg.type) {
case omx_message::EVENT:
{
diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp
index f19c16a..2ba63f7 100644
--- a/media/libstagefright/omx/OMX.cpp
+++ b/media/libstagefright/omx/OMX.cpp
@@ -89,6 +89,9 @@ OMX::CallbackDispatcher::~CallbackDispatcher() {
mQueueChanged.signal();
}
+ // Don't call join on myself
+ CHECK(mThread != pthread_self());
+
void *dummy;
pthread_join(mThread, &dummy);
}
@@ -249,9 +252,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;
}