summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Essick <essick@google.com>2018-05-01 23:39:05 +0000
committerRay Essick <essick@google.com>2018-05-02 16:47:20 +0000
commite1dfe8f5041c929d25c54f598657c6a6457ee3c7 (patch)
tree352779bdd1093e355840d9ace8802904a471eeef
parentfd2e438d1b2cff89a3150e575e77341a7f01679e (diff)
downloadmedia-e1dfe8f5041c929d25c54f598657c6a6457ee3c7.tar.gz
Revert "mm-video-v4l2: Protect buffer access and increase input buffer size"
This reverts commit fd2e438d1b2cff89a3150e575e77341a7f01679e. Reason for revert: regression failures on oc-mr1/bullhead Change-Id: Ifd50946f0cdbf068ff7bb9fc46f8f1254d196ace Bug: 64340487 Bug: 78291359 Bug: 78913375 Merged-In: I800e3da4f056fe37be23a7a2567171f42c92e4a6 Merged-In: I9db2e2592600137151d0e3f86f6b6dc2f03a950d Merged-In: Ibd1ed01c7d740553b3cf90b6f3dd2fd447563284 Merged-In: I1763963839375db90f76dd0022bd1767ac5f067d Merged-In: I69398d4fb236289be5f0b79f8db9a3bc30144b90 Merged-In: Ie9caad90482698913db06cdb9aeebfd869fe1a6a
-rw-r--r--mm-video-v4l2/vidc/vdec/inc/omx_vdec.h4
-rw-r--r--mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp29
2 files changed, 6 insertions, 27 deletions
diff --git a/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h b/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
index f043172..bc3d41a 100644
--- a/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
+++ b/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
@@ -1,5 +1,5 @@
/*--------------------------------------------------------------------------
-Copyright (c) 2010 - 2014, 2018, The Linux Foundation. All rights reserved.
+Copyright (c) 2010 - 2014, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -1098,7 +1098,7 @@ class omx_vdec: public qc_omx_component
}
static OMX_ERRORTYPE describeColorFormat(OMX_PTR params);
- bool m_buffer_error;
+
};
#ifdef _MSM8974_
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 4118ba0..c0d19e0 100644
--- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp
@@ -592,8 +592,7 @@ omx_vdec::omx_vdec(): m_error_propogated(false),
client_set_fps(false),
m_last_rendered_TS(-1),
m_queued_codec_config_count(0),
- secure_scaling_to_non_secure_opb(false),
- m_buffer_error(false)
+ secure_scaling_to_non_secure_opb(false)
{
/* Assumption is that , to begin with , we have all the frames with decoder */
DEBUG_PRINT_HIGH("In %u bit OMX vdec Constructor", (unsigned int)sizeof(long) * 8);
@@ -4704,7 +4703,6 @@ OMX_ERRORTYPE omx_vdec::use_output_buffer(
eRet = allocate_output_headers();
if (eRet == OMX_ErrorNone)
eRet = allocate_extradata();
- output_use_buffer = true;
}
if (eRet == OMX_ErrorNone) {
@@ -5317,7 +5315,6 @@ OMX_ERRORTYPE omx_vdec::allocate_input_buffer(
unsigned i = 0;
unsigned char *buf_addr = NULL;
int pmem_fd = -1;
- unsigned int align_size = 0;
(void) hComp;
(void) port;
@@ -5377,10 +5374,8 @@ OMX_ERRORTYPE omx_vdec::allocate_input_buffer(
int rc;
DEBUG_PRINT_LOW("Allocate input Buffer");
#ifdef USE_ION
- align_size = drv_ctx.ip_buf.buffer_size + 512;
- align_size = (align_size + drv_ctx.ip_buf.alignment - 1)&(~(drv_ctx.ip_buf.alignment - 1));
drv_ctx.ip_buf_ion_info[i].ion_device_fd = alloc_map_ion_memory(
- align_size, drv_ctx.op_buf.alignment,
+ drv_ctx.ip_buf.buffer_size,drv_ctx.op_buf.alignment,
&drv_ctx.ip_buf_ion_info[i].ion_alloc_data,
&drv_ctx.ip_buf_ion_info[i].fd_ion_data, secure_mode ? ION_SECURE
#ifndef DISABLE_INPUT_BUFFER_CACHE
@@ -5873,10 +5868,6 @@ OMX_ERRORTYPE omx_vdec::allocate_buffer(OMX_IN OMX_HANDLETYPE hC
eRet = allocate_input_buffer(hComp,bufferHdr,port,appData,bytes);
}
} else if (port == OMX_CORE_OUTPUT_PORT_INDEX) {
- if (output_use_buffer) {
- DEBUG_PRINT_ERROR("Allocate output buffer not allowed after use buffer");
- return OMX_ErrorBadParameter;
- }
eRet = client_buffers.allocate_buffers_color_convert(hComp,bufferHdr,port,
appData,bytes);
} else {
@@ -5937,7 +5928,6 @@ OMX_ERRORTYPE omx_vdec::free_buffer(OMX_IN OMX_HANDLETYPE hComp,
(void) hComp;
DEBUG_PRINT_LOW("In for decoder free_buffer");
- auto_lock l(buf_lock);
if (m_state == OMX_StateIdle &&
(BITMASK_PRESENT(&m_flags ,OMX_COMPONENT_LOADING_PENDING))) {
DEBUG_PRINT_LOW(" free buffer while Component in Loading pending");
@@ -5954,7 +5944,7 @@ OMX_ERRORTYPE omx_vdec::free_buffer(OMX_IN OMX_HANDLETYPE hComp,
post_event(OMX_EventError,
OMX_ErrorPortUnpopulated,
OMX_COMPONENT_GENERATE_EVENT);
- m_buffer_error = true;
+
return OMX_ErrorIncorrectStateOperation;
} else if (m_state != OMX_StateInvalid) {
DEBUG_PRINT_ERROR("Invalid state to free buffer,port lost Buffers");
@@ -6059,7 +6049,6 @@ OMX_ERRORTYPE omx_vdec::free_buffer(OMX_IN OMX_HANDLETYPE hComp,
BITMASK_CLEAR((&m_flags),OMX_COMPONENT_LOADING_PENDING);
post_event(OMX_CommandStateSet, OMX_StateLoaded,
OMX_COMPONENT_GENERATE_EVENT);
- m_buffer_error = false;
}
}
return eRet;
@@ -6233,11 +6222,6 @@ OMX_ERRORTYPE omx_vdec::empty_this_buffer_proxy(OMX_IN OMX_HANDLETYPE hComp,
if (!temp_buffer || (temp_buffer - drv_ctx.ptr_inputbuffer) > (int)drv_ctx.ip_buf.actualcount) {
return OMX_ErrorBadParameter;
}
-
- if (BITMASK_ABSENT(&m_inp_bm_count, nPortIndex) || m_buffer_error) {
- DEBUG_PRINT_ERROR("ETBProxy: ERROR: invalid buffer, nPortIndex %u", nPortIndex);
- return OMX_ErrorBadParameter;
- }
/* If its first frame, H264 codec and reject is true, then parse the nal
and get the profile. Based on this, reject the clip playback */
if (first_frame == 0 && codec_type_parse == CODEC_TYPE_H264 &&
@@ -6521,7 +6505,6 @@ OMX_ERRORTYPE omx_vdec::fill_this_buffer_proxy(
struct vdec_bufferpayload *ptr_outputbuffer = NULL;
struct vdec_output_frameinfo *ptr_respbuffer = NULL;
- auto_lock l(buf_lock);
nPortIndex = buffer-((OMX_BUFFERHEADERTYPE *)client_buffers.get_il_buf_hdr());
if (bufferAdd == NULL || nPortIndex >= drv_ctx.op_buf.actualcount) {
@@ -6530,10 +6513,6 @@ OMX_ERRORTYPE omx_vdec::fill_this_buffer_proxy(
return OMX_ErrorBadParameter;
}
- if (BITMASK_ABSENT(&m_out_bm_count, nPortIndex) || m_buffer_error) {
- DEBUG_PRINT_ERROR("FTBProxy: ERROR: invalid buffer, nPortIndex %u", nPortIndex);
- return OMX_ErrorBadParameter;
- }
DEBUG_PRINT_LOW("FTBProxy: bufhdr = %p, bufhdr->pBuffer = %p",
bufferAdd, bufferAdd->pBuffer);
/*Return back the output buffer to client*/
@@ -7692,7 +7671,7 @@ int omx_vdec::async_message_process (void *context, void* message)
output_respbuf->pic_type = PICTURE_TYPE_B;
}
- if (!omx->m_enable_android_native_buffers && omx->output_use_buffer)
+ if (omx->output_use_buffer)
memcpy ( omxhdr->pBuffer, (void *)
((unsigned long)vdec_msg->msgdata.output_frame.bufferaddr +
(unsigned long)vdec_msg->msgdata.output_frame.offset),