From b907369f7f3203e6c673335470751cc679b2121e Mon Sep 17 00:00:00 2001 From: Taehwan Kim Date: Mon, 29 Oct 2012 13:12:08 +0900 Subject: [PATCH] vdec/include: fixed to return an input buffer to client Error frame is skipped by Check_Stream_StartCode function. but, It isn't returned to client. added OMX_ErrorCorruptedFrame return type and handling scheme. Change-Id: I18bff34e143b6b956f77346f27c8926c5aef1022 Signed-off-by: Taehwan Kim Signed-off-by: Huisung Kang --- component/video/dec/Exynos_OMX_Vdec.c | 13 +++++++++++++ component/video/dec/h264/Exynos_OMX_H264dec.c | 10 ++++++++-- component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c | 10 ++++++++-- component/video/dec/vp8/Exynos_OMX_Vp8dec.c | 10 ++++++++-- include/exynos/Exynos_OMX_Def.h | 3 ++- 5 files changed, 39 insertions(+), 7 deletions(-) diff --git a/component/video/dec/Exynos_OMX_Vdec.c b/component/video/dec/Exynos_OMX_Vdec.c index fb136f7..0bc1695 100644 --- a/component/video/dec/Exynos_OMX_Vdec.c +++ b/component/video/dec/Exynos_OMX_Vdec.c @@ -610,6 +610,19 @@ OMX_ERRORTYPE Exynos_OMX_SrcInputBufferProcess(OMX_HANDLETYPE hComponent) } ret = pVideoDec->exynos_codec_srcInputProcess(pOMXComponent, pSrcInputData); + if (ret == OMX_ErrorCorruptedFrame) { + if (exynosInputPort->bufferProcessType & BUFFER_COPY) { + OMX_PTR codecBuffer; + codecBuffer = pSrcInputData->pPrivate; + if (codecBuffer != NULL) + Exynos_CodecBufferEnQueue(pExynosComponent, INPUT_PORT_INDEX, codecBuffer); + } + + if (exynosInputPort->bufferProcessType & BUFFER_SHARE) { + Exynos_OMX_InputBufferReturn(pOMXComponent, pSrcInputData->bufferHeader); + } + } + if (ret != OMX_ErrorInputDataDecodeYet) { Exynos_ResetCodecData(pSrcInputData); } diff --git a/component/video/dec/h264/Exynos_OMX_H264dec.c b/component/video/dec/h264/Exynos_OMX_H264dec.c index 2868d8b..a681b55 100644 --- a/component/video/dec/h264/Exynos_OMX_H264dec.c +++ b/component/video/dec/h264/Exynos_OMX_H264dec.c @@ -1707,6 +1707,7 @@ OMX_ERRORTYPE Exynos_H264Dec_SrcIn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_ EXYNOS_OMX_BASEPORT *pExynosInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; EXYNOS_OMX_BASEPORT *pExynosOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; OMX_U32 oneFrameSize = pSrcInputData->dataLen; + OMX_BOOL bInStartCode = OMX_FALSE; ExynosVideoDecOps *pDecOps = pH264Dec->hMFCH264Handle.pDecOps; ExynosVideoDecBufferOps *pInbufOps = pH264Dec->hMFCH264Handle.pInbufOps; ExynosVideoDecBufferOps *pOutbufOps = pH264Dec->hMFCH264Handle.pOutbufOps; @@ -1724,7 +1725,7 @@ OMX_ERRORTYPE Exynos_H264Dec_SrcIn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_ } if (((pVideoDec->bDRMPlayerMode == OMX_TRUE) || - (Check_H264_StartCode(pSrcInputData->buffer.singlePlaneBuffer.dataBuffer, oneFrameSize) == OMX_TRUE)) || + ((bInStartCode = Check_H264_StartCode(pSrcInputData->buffer.singlePlaneBuffer.dataBuffer, oneFrameSize)) == OMX_TRUE)) || ((pSrcInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) { pExynosComponent->timeStamp[pH264Dec->hMFCH264Handle.indexTimestamp] = pSrcInputData->timeStamp; pExynosComponent->nFlags[pH264Dec->hMFCH264Handle.indexTimestamp] = pSrcInputData->nFlags; @@ -1753,6 +1754,9 @@ OMX_ERRORTYPE Exynos_H264Dec_SrcIn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_ Exynos_OSAL_SignalSet(pH264Dec->hDestinationStartEvent); Exynos_OSAL_SleepMillisec(0); } + } else if (bInStartCode == OMX_FALSE) { + ret = OMX_ErrorCorruptedFrame; + goto EXIT; } ret = OMX_ErrorNone; @@ -2010,7 +2014,9 @@ OMX_ERRORTYPE Exynos_H264Dec_srcInputBufferProcess(OMX_COMPONENTTYPE *pOMXCompon } ret = Exynos_H264Dec_SrcIn(pOMXComponent, pSrcInputData); - if ((ret != OMX_ErrorNone) && (ret != OMX_ErrorInputDataDecodeYet)) { + if ((ret != OMX_ErrorNone) && + (ret != OMX_ErrorInputDataDecodeYet) && + (ret != OMX_ErrorCorruptedFrame)) { pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent, pExynosComponent->callbackData, OMX_EventError, ret, 0, NULL); diff --git a/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c b/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c index 5a22055..1e6f36a 100644 --- a/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c +++ b/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c @@ -1762,6 +1762,7 @@ OMX_ERRORTYPE Exynos_Mpeg4Dec_SrcIn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX EXYNOS_OMX_BASEPORT *pExynosInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; EXYNOS_OMX_BASEPORT *pExynosOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; OMX_U32 oneFrameSize = pSrcInputData->dataLen; + OMX_BOOL bInStartCode = OMX_FALSE; ExynosVideoDecOps *pDecOps = pMpeg4Dec->hMFCMpeg4Handle.pDecOps; ExynosVideoDecBufferOps *pInbufOps = pMpeg4Dec->hMFCMpeg4Handle.pInbufOps; ExynosVideoDecBufferOps *pOutbufOps = pMpeg4Dec->hMFCMpeg4Handle.pOutbufOps; @@ -1778,7 +1779,7 @@ OMX_ERRORTYPE Exynos_Mpeg4Dec_SrcIn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX ret = Mpeg4CodecDstSetup(pOMXComponent); } - if ((Check_Stream_StartCode(pSrcInputData->buffer.singlePlaneBuffer.dataBuffer, oneFrameSize, pMpeg4Dec->hMFCMpeg4Handle.codecType) == OMX_TRUE) || + if (((bInStartCode = Check_Stream_StartCode(pSrcInputData->buffer.singlePlaneBuffer.dataBuffer, oneFrameSize, pMpeg4Dec->hMFCMpeg4Handle.codecType)) == OMX_TRUE) || ((pSrcInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) { pExynosComponent->timeStamp[pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp] = pSrcInputData->timeStamp; pExynosComponent->nFlags[pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp] = pSrcInputData->nFlags; @@ -1807,6 +1808,9 @@ OMX_ERRORTYPE Exynos_Mpeg4Dec_SrcIn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX Exynos_OSAL_SignalSet(pMpeg4Dec->hDestinationStartEvent); Exynos_OSAL_SleepMillisec(0); } + } else if (bInStartCode == OMX_FALSE) { + ret = OMX_ErrorCorruptedFrame; + goto EXIT; } ret = OMX_ErrorNone; @@ -2055,7 +2059,9 @@ OMX_ERRORTYPE Exynos_Mpeg4Dec_srcInputBufferProcess(OMX_COMPONENTTYPE *pOMXCompo } ret = Exynos_Mpeg4Dec_SrcIn(pOMXComponent, pSrcInputData); - if ((ret != OMX_ErrorNone) && (ret != OMX_ErrorInputDataDecodeYet)) { + if ((ret != OMX_ErrorNone) && + (ret != OMX_ErrorInputDataDecodeYet) && + (ret != OMX_ErrorCorruptedFrame)) { pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent, pExynosComponent->callbackData, OMX_EventError, ret, 0, NULL); diff --git a/component/video/dec/vp8/Exynos_OMX_Vp8dec.c b/component/video/dec/vp8/Exynos_OMX_Vp8dec.c index c14ec9d..cfb57ca 100644 --- a/component/video/dec/vp8/Exynos_OMX_Vp8dec.c +++ b/component/video/dec/vp8/Exynos_OMX_Vp8dec.c @@ -1354,6 +1354,7 @@ OMX_ERRORTYPE Exynos_VP8Dec_SrcIn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_D EXYNOS_OMX_BASEPORT *pExynosInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; EXYNOS_OMX_BASEPORT *pExynosOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; OMX_U32 oneFrameSize = pSrcInputData->dataLen; + OMX_BOOL bInStartCode = OMX_FALSE; ExynosVideoDecOps *pDecOps = pVp8Dec->hMFCVp8Handle.pDecOps; ExynosVideoDecBufferOps *pInbufOps = pVp8Dec->hMFCVp8Handle.pInbufOps; ExynosVideoDecBufferOps *pOutbufOps = pVp8Dec->hMFCVp8Handle.pOutbufOps; @@ -1370,7 +1371,7 @@ OMX_ERRORTYPE Exynos_VP8Dec_SrcIn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_D ret = VP8CodecDstSetup(pOMXComponent); } - if ((Check_VP8_StartCode(pSrcInputData->buffer.singlePlaneBuffer.dataBuffer, oneFrameSize) == OMX_TRUE) || + if (((bInStartCode = Check_VP8_StartCode(pSrcInputData->buffer.singlePlaneBuffer.dataBuffer, oneFrameSize)) == OMX_TRUE) || ((pSrcInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) { pExynosComponent->timeStamp[pVp8Dec->hMFCVp8Handle.indexTimestamp] = pSrcInputData->timeStamp; pExynosComponent->nFlags[pVp8Dec->hMFCVp8Handle.indexTimestamp] = pSrcInputData->nFlags; @@ -1399,6 +1400,9 @@ OMX_ERRORTYPE Exynos_VP8Dec_SrcIn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_D Exynos_OSAL_SignalSet(pVp8Dec->hDestinationStartEvent); Exynos_OSAL_SleepMillisec(0); } + } else if (bInStartCode == OMX_FALSE) { + ret = OMX_ErrorCorruptedFrame; + goto EXIT; } ret = OMX_ErrorNone; @@ -1647,7 +1651,9 @@ OMX_ERRORTYPE Exynos_VP8Dec_srcInputBufferProcess(OMX_COMPONENTTYPE *pOMXCompone } ret = Exynos_VP8Dec_SrcIn(pOMXComponent, pSrcInputData); - if ((ret != OMX_ErrorNone) && (ret != OMX_ErrorInputDataDecodeYet)) { + if ((ret != OMX_ErrorNone) && + (ret != OMX_ErrorInputDataDecodeYet) && + (ret != OMX_ErrorCorruptedFrame)) { pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent, pExynosComponent->callbackData, OMX_EventError, ret, 0, NULL); diff --git a/include/exynos/Exynos_OMX_Def.h b/include/exynos/Exynos_OMX_Def.h index da699d4..48b0ea3 100644 --- a/include/exynos/Exynos_OMX_Def.h +++ b/include/exynos/Exynos_OMX_Def.h @@ -101,7 +101,8 @@ typedef enum _EXYNOS_OMX_ERRORTYPE OMX_ErrorCodecDecode = (OMX_S32) 0x90000005, OMX_ErrorCodecEncode = (OMX_S32) 0x90000006, OMX_ErrorCodecFlush = (OMX_S32) 0x90000007, - OMX_ErrorOutputBufferUseYet = (OMX_S32) 0x90000008 + OMX_ErrorOutputBufferUseYet = (OMX_S32) 0x90000008, + OMX_ErrorCorruptedFrame = (OMX_S32) 0x90000009 } EXYNOS_OMX_ERRORTYPE; typedef enum _EXYNOS_OMX_COMMANDTYPE -- 2.20.1