summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp68
-rwxr-xr-x[-rw-r--r--]mm-video-v4l2/vidc/venc/src/omx_video_base.cpp12
-rwxr-xr-xmm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp13
3 files changed, 13 insertions, 80 deletions
diff --git a/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp b/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp
index 4ce2e6e..b425157 100644..100755
--- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp
@@ -3075,13 +3075,6 @@ OMX_ERRORTYPE omx_vdec::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamPortDefinition H= %d, W = %d",
(int)portDefn->format.video.nFrameHeight,
(int)portDefn->format.video.nFrameWidth);
-
- if (portDefn->nBufferCountActual > MAX_NUM_INPUT_OUTPUT_BUFFERS) {
- DEBUG_PRINT_ERROR("ERROR: Buffers requested exceeds max limit %d",
- portDefn->nBufferCountActual);
- eRet = OMX_ErrorBadParameter;
- break;
- }
if (OMX_DirOutput == portDefn->eDir) {
DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamPortDefinition OP port");
m_display_id = portDefn->format.video.pNativeWindow;
@@ -3218,15 +3211,6 @@ OMX_ERRORTYPE omx_vdec::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
eRet = get_buffer_req(&drv_ctx.op_buf);
}
}
- // Buffer count can change only when port is unallocated
- if (m_inp_mem_ptr &&
- (portDefn->nBufferCountActual != drv_ctx.ip_buf.actualcount ||
- portDefn->nBufferSize != drv_ctx.ip_buf.buffer_size)) {
- DEBUG_PRINT_ERROR("Cannot change i/p buffer count since all buffers are not freed yet !");
- eRet = OMX_ErrorInvalidState;
- break;
- }
-
if (portDefn->nBufferCountActual >= drv_ctx.ip_buf.mincount
|| portDefn->nBufferSize != drv_ctx.ip_buf.buffer_size) {
port_format_changed = true;
@@ -3302,14 +3286,6 @@ OMX_ERRORTYPE omx_vdec::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
/* Input port */
if (portFmt->nPortIndex == 0) {
- // arbitrary_bytes mode cannot be changed arbitrarily since this controls how:
- // - headers are allocated and
- // - headers-indices are derived
- // Avoid changing arbitrary_bytes when the port is already allocated
- if (m_inp_mem_ptr) {
- DEBUG_PRINT_ERROR("Cannot change arbitrary-bytes-mode since input port is not free!");
- return OMX_ErrorUnsupportedSetting;
- }
if (portFmt->nFramePackingFormat == OMX_QCOM_FramePacking_Arbitrary) {
if (secure_mode) {
arbitrary_bytes = false;
@@ -3628,15 +3604,6 @@ OMX_ERRORTYPE omx_vdec::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
* with openmax standard. */
case OMX_GoogleAndroidIndexEnableAndroidNativeBuffers: {
EnableAndroidNativeBuffersParams* enableNativeBuffers = (EnableAndroidNativeBuffersParams *) paramData;
- if (enableNativeBuffers->nPortIndex != OMX_CORE_OUTPUT_PORT_INDEX) {
- DEBUG_PRINT_ERROR("Enable/Disable android-native-buffers allowed only on output port!");
- eRet = OMX_ErrorUnsupportedSetting;
- break;
- } else if (m_out_mem_ptr) {
- DEBUG_PRINT_ERROR("Enable/Disable android-native-buffers is not allowed since Output port is not free !");
- eRet = OMX_ErrorInvalidState;
- break;
- }
if (enableNativeBuffers) {
m_enable_android_native_buffers = enableNativeBuffers->enable;
}
@@ -3688,11 +3655,6 @@ OMX_ERRORTYPE omx_vdec::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
break;
}
if (metabuffer->nPortIndex == OMX_CORE_OUTPUT_PORT_INDEX) {
- if (m_out_mem_ptr) {
- DEBUG_PRINT_ERROR("Enable/Disable dynamic-buffer-mode is not allowed since Output port is not free !");
- eRet = OMX_ErrorInvalidState;
- break;
- }
//set property dynamic buffer mode to driver.
struct v4l2_control control;
struct v4l2_format fmt;
@@ -4681,16 +4643,9 @@ OMX_ERRORTYPE omx_vdec::use_buffer(
DEBUG_PRINT_ERROR("Use Buffer in Invalid State");
return OMX_ErrorInvalidState;
}
- if (port == OMX_CORE_INPUT_PORT_INDEX) {
- // If this is not the first allocation (i.e m_inp_mem_ptr is allocated),
- // ensure that use-buffer was called for previous allocation.
- // Mix-and-match of useBuffer and allocateBuffer is not allowed
- if (m_inp_mem_ptr && !input_use_buffer) {
- DEBUG_PRINT_ERROR("'Use' Input buffer called after 'Allocate' Input buffer !");
- return OMX_ErrorUndefined;
- }
+ if (port == OMX_CORE_INPUT_PORT_INDEX)
error = use_input_heap_buffers(hComp, bufferHdr, port, appData, bytes, buffer);
- } else if (port == OMX_CORE_OUTPUT_PORT_INDEX)
+ else if (port == OMX_CORE_OUTPUT_PORT_INDEX)
error = use_output_buffer(hComp,bufferHdr,port,appData,bytes,buffer); //not tested
else {
DEBUG_PRINT_ERROR("Error: Invalid Port Index received %d",(int)port);
@@ -5452,13 +5407,6 @@ OMX_ERRORTYPE omx_vdec::allocate_buffer(OMX_IN OMX_HANDLETYPE hC
}
if (port == OMX_CORE_INPUT_PORT_INDEX) {
- // If this is not the first allocation (i.e m_inp_mem_ptr is allocated),
- // ensure that use-buffer was never called.
- // Mix-and-match of useBuffer and allocateBuffer is not allowed
- if (m_inp_mem_ptr && input_use_buffer) {
- DEBUG_PRINT_ERROR("'Allocate' Input buffer called after 'Use' Input buffer !");
- return OMX_ErrorUndefined;
- }
if (arbitrary_bytes) {
eRet = allocate_input_heap_buffer (hComp,bufferHdr,port,appData,bytes);
} else {
@@ -5713,10 +5661,6 @@ OMX_ERRORTYPE omx_vdec::empty_this_buffer(OMX_IN OMX_HANDLETYPE hComp,
} else {
if (input_use_buffer == true) {
nBufferIndex = buffer - m_inp_heap_ptr;
- if (nBufferIndex >= drv_ctx.ip_buf.actualcount ) {
- DEBUG_PRINT_ERROR("ERROR: ETB nBufferIndex is invalid in use-buffer mode");
- return OMX_ErrorBadParameter;
- }
m_inp_mem_ptr[nBufferIndex].nFilledLen = m_inp_heap_ptr[nBufferIndex].nFilledLen;
m_inp_mem_ptr[nBufferIndex].nTimeStamp = m_inp_heap_ptr[nBufferIndex].nTimeStamp;
m_inp_mem_ptr[nBufferIndex].nFlags = m_inp_heap_ptr[nBufferIndex].nFlags;
@@ -5728,7 +5672,7 @@ OMX_ERRORTYPE omx_vdec::empty_this_buffer(OMX_IN OMX_HANDLETYPE hComp,
}
}
- if (nBufferIndex >= drv_ctx.ip_buf.actualcount ) {
+ if (nBufferIndex > drv_ctx.ip_buf.actualcount ) {
DEBUG_PRINT_ERROR("ERROR:ETB nBufferIndex is invalid");
return OMX_ErrorBadParameter;
}
@@ -5785,7 +5729,7 @@ OMX_ERRORTYPE omx_vdec::empty_this_buffer_proxy(OMX_IN OMX_HANDLETYPE hComp,
nPortIndex = buffer-((OMX_BUFFERHEADERTYPE *)m_inp_mem_ptr);
- if (nPortIndex >= drv_ctx.ip_buf.actualcount) {
+ if (nPortIndex > drv_ctx.ip_buf.actualcount) {
DEBUG_PRINT_ERROR("ERROR:empty_this_buffer_proxy invalid nPortIndex[%u]",
nPortIndex);
return OMX_ErrorBadParameter;
@@ -6105,7 +6049,7 @@ OMX_ERRORTYPE omx_vdec::fill_this_buffer_proxy(
nPortIndex = buffer-((OMX_BUFFERHEADERTYPE *)client_buffers.get_il_buf_hdr());
- if (bufferAdd == NULL || nPortIndex >= drv_ctx.op_buf.actualcount)
+ if (bufferAdd == NULL || nPortIndex > drv_ctx.op_buf.actualcount)
return OMX_ErrorBadParameter;
DEBUG_PRINT_LOW("FTBProxy: bufhdr = %p, bufhdr->pBuffer = %p",
@@ -6960,7 +6904,7 @@ OMX_ERRORTYPE omx_vdec::empty_buffer_done(OMX_HANDLETYPE hComp,
OMX_BUFFERHEADERTYPE* buffer)
{
- if (buffer == NULL || ((buffer - m_inp_mem_ptr) >= (int)drv_ctx.ip_buf.actualcount)) {
+ if (buffer == NULL || ((buffer - m_inp_mem_ptr) > (int)drv_ctx.ip_buf.actualcount)) {
DEBUG_PRINT_ERROR("empty_buffer_done: ERROR bufhdr = %p", buffer);
return OMX_ErrorBadParameter;
}
diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
index e72d012..0cf76d9 100644..100755
--- a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
@@ -3113,15 +3113,17 @@ OMX_ERRORTYPE omx_video::free_buffer(OMX_IN OMX_HANDLETYPE hComp,
m_sInPortDef.bPopulated = OMX_FALSE;
/*Free the Buffer Header*/
- if (release_input_done()) {
+ if (release_input_done()
+#ifdef _ANDROID_ICS_
+ && !meta_mode_enable
+#endif
+ ) {
input_use_buffer = false;
- // "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) {
+ if (m_inp_mem_ptr) {
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/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
index 7d21836..63deeeb 100755
--- a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
@@ -533,12 +533,6 @@ OMX_ERRORTYPE omx_venc::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
DEBUG_PRINT_LOW("i/p actual cnt requested = %u", (unsigned int)portDefn->nBufferCountActual);
DEBUG_PRINT_LOW("i/p min cnt requested = %u", (unsigned int)portDefn->nBufferCountMin);
DEBUG_PRINT_LOW("i/p buffersize requested = %u", (unsigned int)portDefn->nBufferSize);
- 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);
@@ -586,13 +580,6 @@ OMX_ERRORTYPE omx_venc::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
DEBUG_PRINT_LOW("o/p actual cnt requested = %u", (unsigned int)portDefn->nBufferCountActual);
DEBUG_PRINT_LOW("o/p min cnt requested = %u", (unsigned int)portDefn->nBufferCountMin);
DEBUG_PRINT_LOW("o/p buffersize requested = %u", (unsigned int)portDefn->nBufferSize);
- 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);