aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorywan171 <yi.a.wang@intel.com>2014-10-22 10:42:18 +0800
committerThe Android Automerger <android-build@google.com>2014-10-23 17:37:00 -0700
commit8dab298d1fb1cfff579e819e8cd79f998d3aa715 (patch)
treec4ca80120024efb4995e4c830d7e751bb240b73a
parentf2448e1c21d9d9a16916c19fa4aec340b762fb8e (diff)
downloadandroid_hardware_intel_common_omx-components-staging/cm-12.0-caf.tar.gz
android_hardware_intel_common_omx-components-staging/cm-12.0-caf.tar.bz2
android_hardware_intel_common_omx-components-staging/cm-12.0-caf.zip
vp9HWR: fix free issue in multi-threadstaging/cm-12.0-cafstaging/cm-12.0
Bug: 18080142 Change-Id: Ie17b80dda21a97712fa8dfa35dbf6671ffc15dcb Signed-off-by: ywan171 <yi.a.wang@intel.com>
-rw-r--r--videocodec/OMXVideoDecoderVP9HWR.cpp35
-rw-r--r--videocodec/OMXVideoDecoderVP9HWR.h21
2 files changed, 24 insertions, 32 deletions
diff --git a/videocodec/OMXVideoDecoderVP9HWR.cpp b/videocodec/OMXVideoDecoderVP9HWR.cpp
index 8497f09..8566913 100644
--- a/videocodec/OMXVideoDecoderVP9HWR.cpp
+++ b/videocodec/OMXVideoDecoderVP9HWR.cpp
@@ -106,32 +106,32 @@ int getVP9FrameBuffer(void *user_priv,
unsigned int new_size,
vpx_codec_frame_buffer_t *fb)
{
- (void)user_priv;
+ OMXVideoDecoderVP9HWR * p = (OMXVideoDecoderVP9HWR *)user_priv;
if (fb == NULL) {
return -1;
}
// TODO: Adaptive playback case needs to reconsider
- if (extNativeBufferSize < new_size) {
+ if (p->extNativeBufferSize < new_size) {
LOGE("Provided frame buffer size < requesting min size.");
return -1;
}
int i;
- for (i = 0; i < extMappedNativeBufferCount; i++ ) {
- if ((extMIDs[i]->m_render_done == true) &&
- (extMIDs[i]->m_released == true)) {
- fb->data = extMIDs[i]->m_usrAddr;
- fb->size = extNativeBufferSize;
- fb->fb_stride = extActualBufferStride;
- fb->fb_height_stride = extActualBufferHeightStride;
+ for (i = 0; i < p->extMappedNativeBufferCount; i++ ) {
+ if ((p->extMIDs[i]->m_render_done == true) &&
+ (p->extMIDs[i]->m_released == true)) {
+ fb->data = p->extMIDs[i]->m_usrAddr;
+ fb->size = p->extNativeBufferSize;
+ fb->fb_stride = p->extActualBufferStride;
+ fb->fb_height_stride = p->extActualBufferHeightStride;
fb->fb_index = i;
- extMIDs[i]->m_released = false;
+ p->extMIDs[i]->m_released = false;
break;
}
}
- if (i == extMappedNativeBufferCount) {
+ if (i == p->extMappedNativeBufferCount) {
LOGE("No available frame buffer in pool.");
return -1;
}
@@ -143,18 +143,18 @@ int getVP9FrameBuffer(void *user_priv,
int releaseVP9FrameBuffer(void *user_priv, vpx_codec_frame_buffer_t *fb)
{
int i;
- user_priv = user_priv; // to remove warning
+ OMXVideoDecoderVP9HWR * p = (OMXVideoDecoderVP9HWR *)user_priv;
if (fb == NULL) {
return -1;
}
- for (i = 0; i < extMappedNativeBufferCount; i++ ) {
- if (fb->data == extMIDs[i]->m_usrAddr) {
- extMIDs[i]->m_released = true;
+ for (i = 0; i < p->extMappedNativeBufferCount; i++ ) {
+ if (fb->data == p->extMIDs[i]->m_usrAddr) {
+ p->extMIDs[i]->m_released = true;
break;
}
}
- if (i == extMappedNativeBufferCount) {
+ if (i == p->extMappedNativeBufferCount) {
LOGE("Not found matching frame buffer in pool, libvpx's wrong?");
return -1;
}
@@ -182,7 +182,7 @@ OMX_ERRORTYPE OMXVideoDecoderVP9HWR::initDecoder()
if (vpx_codec_set_frame_buffer_functions((vpx_codec_ctx_t *)mCtx,
getVP9FrameBuffer,
releaseVP9FrameBuffer,
- NULL)) {
+ this)) {
LOGE("Failed to configure external frame buffers");
return OMX_ErrorNotReady;
}
@@ -367,7 +367,6 @@ OMX_ERRORTYPE OMXVideoDecoderVP9HWR::ProcessorDeinit(void)
delete extMIDs[i]->m_surface;
free(extMIDs[i]);
}
-
return OMXComponentCodecBase::ProcessorDeinit();
}
diff --git a/videocodec/OMXVideoDecoderVP9HWR.h b/videocodec/OMXVideoDecoderVP9HWR.h
index 069b182..e55f54e 100644
--- a/videocodec/OMXVideoDecoderVP9HWR.h
+++ b/videocodec/OMXVideoDecoderVP9HWR.h
@@ -43,25 +43,19 @@ typedef unsigned int Display;
#define DECODE_WITH_GRALLOC_BUFFER
#define VPX_DECODE_BORDER 0
-// Make it global to be accessed by callback realloc func
#define MAX_NATIVE_BUFFER_COUNT 64
-vaapiMemId* extMIDs[MAX_NATIVE_BUFFER_COUNT];
-int extUtilBufferCount;
-int extMappedNativeBufferCount;
-unsigned int extNativeBufferSize;
-
-// These two strides are passed into libvpx to indicate the external buffer size
-// in case that video demension is smaller than these, libvpx inside should
-// ajust the start point of address of decoded y/v/u component.
-// This is especially for adaptive playback case. External buffer is always allocated
-// (or mapped from vaSurface) to a pre-set max size.
-int extActualBufferStride;
-int extActualBufferHeightStride;
class OMXVideoDecoderVP9HWR : public OMXVideoDecoderBase {
public:
OMXVideoDecoderVP9HWR();
virtual ~OMXVideoDecoderVP9HWR();
+ vaapiMemId* extMIDs[MAX_NATIVE_BUFFER_COUNT];
+ int extUtilBufferCount;
+ int extMappedNativeBufferCount;
+ unsigned int extNativeBufferSize;
+ // (or mapped from vaSurface) to a pre-set max size.
+ int extActualBufferStride;
+ int extActualBufferHeightStride;
protected:
virtual OMX_ERRORTYPE InitInputPortFormatSpecific(OMX_PARAM_PORTDEFINITIONTYPE *paramPortDefinitionInput);
@@ -98,7 +92,6 @@ protected:
friend int reallocVP9FrameBuffer(void *user_priv, unsigned int new_size, vpx_codec_frame_buffer_t *fb);
DECLARE_HANDLER(OMXVideoDecoderVP9HWR, ParamVideoVp9);
-
private:
OMX_ERRORTYPE initDecoder();
OMX_ERRORTYPE destroyDecoder();