Loading media/libstagefright/omx/OMXNodeInstance.cpp +16 −8 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ #include <hidlmemory/mapping.h> #include <vector> static const OMX_U32 kPortIndexInput = 0; static const OMX_U32 kPortIndexOutput = 1; Loading Loading @@ -493,9 +495,7 @@ status_t OMXNodeInstance::freeNode() { case OMX_StateLoaded: { if (mActiveBuffers.size() > 0) { freeActiveBuffers(); } FALLTHROUGH_INTENDED; } case OMX_StateInvalid: Loading Loading @@ -2430,11 +2430,19 @@ void OMXNodeInstance::removeActiveBuffer( } void OMXNodeInstance::freeActiveBuffers() { // Make sure to count down here, as freeBuffer will in turn remove // the active buffer from the vector... for (size_t i = mActiveBuffers.size(); i > 0;) { i--; freeBuffer(mActiveBuffers[i].mPortIndex, mActiveBuffers[i].mID); std::vector<OMX_U32> portIndices; std::vector<IOMX::buffer_id> bufferIds; { // Access to mActiveBuffers must be protected by mLock. Mutex::Autolock _l(mLock); for (const ActiveBuffer& activeBuffer : mActiveBuffers) { portIndices.emplace_back(activeBuffer.mPortIndex); bufferIds.emplace_back(activeBuffer.mID); } } for (size_t i = bufferIds.size(); i > 0; ) { --i; freeBuffer(portIndices[i], bufferIds[i]); } } Loading Loading
media/libstagefright/omx/OMXNodeInstance.cpp +16 −8 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ #include <hidlmemory/mapping.h> #include <vector> static const OMX_U32 kPortIndexInput = 0; static const OMX_U32 kPortIndexOutput = 1; Loading Loading @@ -493,9 +495,7 @@ status_t OMXNodeInstance::freeNode() { case OMX_StateLoaded: { if (mActiveBuffers.size() > 0) { freeActiveBuffers(); } FALLTHROUGH_INTENDED; } case OMX_StateInvalid: Loading Loading @@ -2430,11 +2430,19 @@ void OMXNodeInstance::removeActiveBuffer( } void OMXNodeInstance::freeActiveBuffers() { // Make sure to count down here, as freeBuffer will in turn remove // the active buffer from the vector... for (size_t i = mActiveBuffers.size(); i > 0;) { i--; freeBuffer(mActiveBuffers[i].mPortIndex, mActiveBuffers[i].mID); std::vector<OMX_U32> portIndices; std::vector<IOMX::buffer_id> bufferIds; { // Access to mActiveBuffers must be protected by mLock. Mutex::Autolock _l(mLock); for (const ActiveBuffer& activeBuffer : mActiveBuffers) { portIndices.emplace_back(activeBuffer.mPortIndex); bufferIds.emplace_back(activeBuffer.mID); } } for (size_t i = bufferIds.size(); i > 0; ) { --i; freeBuffer(portIndices[i], bufferIds[i]); } } Loading