aboutsummaryrefslogtreecommitdiffstats
path: root/videocodec/OMXVideoDecoderVP9HWR.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'videocodec/OMXVideoDecoderVP9HWR.cpp')
-rw-r--r--videocodec/OMXVideoDecoderVP9HWR.cpp56
1 files changed, 23 insertions, 33 deletions
diff --git a/videocodec/OMXVideoDecoderVP9HWR.cpp b/videocodec/OMXVideoDecoderVP9HWR.cpp
index ec97bac..2170fd0 100644
--- a/videocodec/OMXVideoDecoderVP9HWR.cpp
+++ b/videocodec/OMXVideoDecoderVP9HWR.cpp
@@ -21,8 +21,6 @@
#include "OMXVideoDecoderVP9HWR.h"
#include <system/window.h>
-#include <ui/GraphicBufferMapper.h>
-#include <ui/Rect.h>
#include <HardwareAPI.h>
#include <hardware/hardware.h>
#include <hardware/gralloc.h>
@@ -106,32 +104,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 +141,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 +180,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;
}
@@ -344,26 +342,13 @@ OMX_ERRORTYPE OMXVideoDecoderVP9HWR::ProcessorInit(void)
OMX_ERRORTYPE OMXVideoDecoderVP9HWR::ProcessorDeinit(void)
{
- mOMXBufferHeaderTypePtrNum = 0;
- memset(&mGraphicBufferParam, 0, sizeof(mGraphicBufferParam));
-
destroyDecoder();
unsigned int i = 0;
-
- for (i = 0; i < MAX_NATIVE_BUFFER_COUNT; i++) {
- delete extMIDs[i]->m_surface;
- free(extMIDs[i]);
- }
-
if (mWorkingMode == GRAPHICBUFFER_MODE) {
for (i = 0; i < mOMXBufferHeaderTypePtrNum; i++) {
if (extMIDs[i]->m_surface != NULL) {
vaDestroySurfaces(mVADisplay, extMIDs[i]->m_surface, 1);
}
- if (extMIDs[i]->m_usrAddr != NULL) {
- free(extMIDs[i]->m_usrAddr);
- extMIDs[i]->m_usrAddr = NULL;
- }
}
} else if (mWorkingMode == RAWDATA_MODE) {
@@ -374,7 +359,12 @@ OMX_ERRORTYPE OMXVideoDecoderVP9HWR::ProcessorDeinit(void)
}
}
}
-
+ mOMXBufferHeaderTypePtrNum = 0;
+ memset(&mGraphicBufferParam, 0, sizeof(mGraphicBufferParam));
+ for (i = 0; i < MAX_NATIVE_BUFFER_COUNT; i++) {
+ delete extMIDs[i]->m_surface;
+ free(extMIDs[i]);
+ }
return OMXComponentCodecBase::ProcessorDeinit();
}