diff options
author | Angela Stegmaier <angelabaker@ti.com> | 2017-11-01 16:40:55 -0500 |
---|---|---|
committer | Angela Stegmaier <angelabaker@ti.com> | 2017-11-02 11:51:07 -0500 |
commit | 75a367adaa723ecc46dd982692937397e1f3dda9 (patch) | |
tree | ba027a58fa0a087ddc305d15e75eb008e8b08456 | |
parent | 501417ac59aa638fa2e82040b0489bfd67d18ce1 (diff) | |
download | dra7xx-75a367adaa723ecc46dd982692937397e1f3dda9.tar.gz |
OMX: VIDDEC: Fix Mpeg2 Metadata Buffer Size in Case of Updated Width/Height
In the case of thumbnailing on Android O, the actual width and height are
not coming when SetParams is called the first time but is coming at a later
time. In this case, once the actual width and height is known, the metadata
buffer which is used for Mpeg2 error concealment should be re-allocated if
a larger size is needed.
This patch modifies the location where the metadata buffer is
allocated for Mpeg2 error concealment to also check if the required
size has changed, and if it has, re-allocate the buffer to
acomodate the larger size.
This issue is observed in Android O when thumbnailing for mpeg2. It is not
observed on Android M.
Change-Id: I51487bdea8f4d7c0dff91933507af1dac62b76cb
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
-rw-r--r-- | omx/videodecode/omx_videodec_common/src/omx_video_decoder.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/omx/videodecode/omx_videodec_common/src/omx_video_decoder.c b/omx/videodecode/omx_videodec_common/src/omx_video_decoder.c index 993d6f6..ccc4c6d 100644 --- a/omx/videodecode/omx_videodec_common/src/omx_video_decoder.c +++ b/omx/videodecode/omx_videodec_common/src/omx_video_decoder.c @@ -281,10 +281,14 @@ OMX_ERRORTYPE OMXVidDec_SetParameter(OMX_HANDLETYPE hComponent, /* If MPEG2 and Error Concealment; then memplugin_alloc for pOutBufDescPtr->descs[2] one time allocation only.*/ if (pVidDecComp->tVideoParams[OMX_VIDDEC_INPUT_PORT].eCompressionFormat == OMX_VIDEO_CodingMPEG2) { if (pVidDecComp->sBase.pPorts[OMX_VIDDEC_INPUT_PORT]->sPortDef.format.video.bFlagErrorConcealment) { + /* It's MPEG2 and ErrorConcealment is ON; calculate metadata buffer size based on formula described in MPEG2 User Guide */ + framesize = (((pInputPortDef->format.video.nFrameWidth + 15) / 16) * 16) * (((pInputPortDef->format.video.nFrameHeight + 15) / 16) * 16); + metasize = ((framesize >> 8) * 112) + framesize; + if (pVidDecComp->pmetaBuffer && pVidDecComp->pmetaBuffer->size < metasize) { + memplugin_free((void*)H2P(pVidDecComp->pmetaBuffer)); + pVidDecComp->pmetaBuffer = NULL; + } if (pVidDecComp->pmetaBuffer == NULL) { - /* It's MPEG2 and ErrorConcealment is ON; calculate metadata buffer size based on formula described in MPEG2 User Guide */ - framesize = (((pInputPortDef->format.video.nFrameWidth + 15) / 16) * 16) * (((pInputPortDef->format.video.nFrameHeight + 15) / 16) * 16); - metasize = ((framesize >> 8) * 112) + framesize; pVidDecComp->pmetaBuffer = P2H(memplugin_alloc(metasize, 1, MEM_CARVEOUT, 0, 0)); OMX_CHECK(pVidDecComp->pmetaBuffer != NULL, OMX_ErrorInsufficientResources); } |