diff options
author | Praveen Chavan <pchavan@codeaurora.org> | 2016-10-14 16:40:39 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-10-14 16:40:39 +0000 |
commit | 9ff997e158806d5968b7badfabac1eab3a2a0f07 (patch) | |
tree | d8465402c121b8c648545a6959db6bca45f2895e /msm8974/mm-video-v4l2 | |
parent | b52e4bbc7df3f6e8214533f0dbd6fc56bd40689b (diff) | |
parent | 3a1263e033a69329c172a0db4477787050ec5c3c (diff) | |
download | media-9ff997e158806d5968b7badfabac1eab3a2a0f07.tar.gz |
mm-video-v4l2: venc: Disallow changing buffer count/size on allocated port am: b7b6466da4
am: 3a1263e033
Change-Id: I4c45d329bf3c803f59fae3fc2578188b018db1ca
Diffstat (limited to 'msm8974/mm-video-v4l2')
-rw-r--r-- | msm8974/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp | 12 | ||||
-rw-r--r-- | msm8974/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp | 13 |
2 files changed, 18 insertions, 7 deletions
diff --git a/msm8974/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp b/msm8974/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp index 9c71157..90e2425 100644 --- a/msm8974/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp +++ b/msm8974/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp @@ -3241,17 +3241,15 @@ OMX_ERRORTYPE omx_video::free_buffer(OMX_IN OMX_HANDLETYPE hComp, m_sInPortDef.bPopulated = OMX_FALSE; /*Free the Buffer Header*/ - if (release_input_done() -#ifdef _ANDROID_ICS_ - && !meta_mode_enable -#endif - ) { + if (release_input_done()) { input_use_buffer = false; - if (m_inp_mem_ptr) { + // "m_inp_mem_ptr" may point to "meta_buffer_hdr" in some modes, + // in which case, it was not explicitly allocated + if (m_inp_mem_ptr && m_inp_mem_ptr != meta_buffer_hdr) { DEBUG_PRINT_LOW("Freeing m_inp_mem_ptr"); free (m_inp_mem_ptr); - m_inp_mem_ptr = NULL; } + m_inp_mem_ptr = NULL; if (m_pInput_pmem) { DEBUG_PRINT_LOW("Freeing m_pInput_pmem"); free(m_pInput_pmem); diff --git a/msm8974/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp b/msm8974/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp index 1da8627..047273a 100644 --- a/msm8974/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp +++ b/msm8974/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp @@ -610,6 +610,12 @@ OMX_ERRORTYPE omx_venc::set_parameter(OMX_IN OMX_HANDLETYPE hComp, (unsigned int)portDefn->nBufferCountActual, (unsigned int)MAX_NUM_INPUT_BUFFERS); return OMX_ErrorUnsupportedSetting; } + if (m_inp_mem_ptr && + (portDefn->nBufferCountActual != m_sInPortDef.nBufferCountActual || + portDefn->nBufferSize != m_sInPortDef.nBufferSize)) { + DEBUG_PRINT_ERROR("ERROR: (In_PORT) buffer count/size can change only if port is unallocated !"); + return OMX_ErrorInvalidState; + } if (portDefn->nBufferCountMin > portDefn->nBufferCountActual) { DEBUG_PRINT_ERROR("ERROR: (In_PORT) Min buffers (%u) > actual count (%u)", (unsigned int)portDefn->nBufferCountMin, (unsigned int)portDefn->nBufferCountActual); @@ -664,6 +670,13 @@ OMX_ERRORTYPE omx_venc::set_parameter(OMX_IN OMX_HANDLETYPE hComp, (unsigned int)portDefn->nBufferCountActual, (unsigned int)MAX_NUM_OUTPUT_BUFFERS); return OMX_ErrorUnsupportedSetting; } + if (m_out_mem_ptr && + (portDefn->nBufferCountActual != m_sOutPortDef.nBufferCountActual || + portDefn->nBufferSize != m_sOutPortDef.nBufferSize)) { + DEBUG_PRINT_ERROR("ERROR: (Out_PORT) buffer count/size can change only if port is unallocated !"); + return OMX_ErrorInvalidState; + } + if (portDefn->nBufferCountMin > portDefn->nBufferCountActual) { DEBUG_PRINT_ERROR("ERROR: (Out_PORT) Min buffers (%u) > actual count (%u)", (unsigned int)portDefn->nBufferCountMin, (unsigned int)portDefn->nBufferCountActual); |