mm-video-v4l2: venc: Protect buffer from being freed while accessing am: 6ec830ac0c

am: c566cb0e26

Change-Id: I0b9c874343a78ab932c7213cf9a28685a164678e
This commit is contained in:
Santhosh Behara 2017-10-10 19:41:33 +00:00 committed by android-build-merger
commit c454469b5f

View file

@ -2746,6 +2746,7 @@ OMX_ERRORTYPE omx_video::use_output_buffer(
return OMX_ErrorBadParameter;
}
auto_lock l(m_buf_lock);
if (!m_out_mem_ptr) {
output_use_buffer = true;
int nBufHdrSize = 0;
@ -3710,6 +3711,7 @@ OMX_ERRORTYPE omx_video::free_buffer(OMX_IN OMX_HANDLETYPE hComp,
nPortIndex, (unsigned int)m_sOutPortDef.nBufferCountActual);
if (nPortIndex < m_sOutPortDef.nBufferCountActual &&
BITMASK_PRESENT(&m_out_bm_count, nPortIndex)) {
auto_lock l(m_buf_lock);
// Clear the bit associated with it.
BITMASK_CLEAR(&m_out_bm_count,nPortIndex);
m_sOutPortDef.bPopulated = OMX_FALSE;