diff options
Diffstat (limited to 'media/libstagefright/omx/OMX.cpp')
-rw-r--r-- | media/libstagefright/omx/OMX.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp index 681e321..29bc733 100644 --- a/media/libstagefright/omx/OMX.cpp +++ b/media/libstagefright/omx/OMX.cpp @@ -252,13 +252,16 @@ status_t OMX::allocateNode( status_t OMX::freeNode(node_id node) { OMXNodeInstance *instance = findInstance(node); - ssize_t index = mLiveNodes.indexOfKey(instance->observer()->asBinder()); - if (index < 0) { - // This could conceivably happen if the observer dies at roughly the - // same time that a client attempts to free the node explicitly. - return OK; + { + Mutex::Autolock autoLock(mLock); + ssize_t index = mLiveNodes.indexOfKey(instance->observer()->asBinder()); + if (index < 0) { + // This could conceivably happen if the observer dies at roughly the + // same time that a client attempts to free the node explicitly. + return OK; + } + mLiveNodes.removeItemsAt(index); } - mLiveNodes.removeItemsAt(index); instance->observer()->asBinder()->unlinkToDeath(this); @@ -266,7 +269,7 @@ status_t OMX::freeNode(node_id node) { { Mutex::Autolock autoLock(mLock); - index = mDispatchers.indexOfKey(node); + ssize_t index = mDispatchers.indexOfKey(node); CHECK(index >= 0); mDispatchers.removeItemsAt(index); } |