diff options
author | Haynes Mathew George <hgeorge@codeaurora.org> | 2012-07-05 17:27:00 -0700 |
---|---|---|
committer | Iliyan Malchev <malchev@google.com> | 2012-07-20 07:13:13 -0700 |
commit | 45dfb6ae94b33eea04d74afa378c1664e884f09a (patch) | |
tree | 4fc280e001b95a441cc0cc4c4124ff960d477cda /media/libstagefright/omx/OMX.cpp | |
parent | 1f1493ce72a3e823daac1b9cd94b2535e27ec8e0 (diff) | |
download | frameworks_av-45dfb6ae94b33eea04d74afa378c1664e884f09a.zip frameworks_av-45dfb6ae94b33eea04d74afa378c1664e884f09a.tar.gz frameworks_av-45dfb6ae94b33eea04d74afa378c1664e884f09a.tar.bz2 |
Synchronize access to OMX class member variables
- Protect access to mLiveNodes KeyedVector member variable in freeNode function
Change-Id: Ic86844aabc2bc897ffb7fc91cd1f54254f5e29fe
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); } |