vdec/include: fixed to return an input buffer to client
authorTaehwan Kim <t_h.kim@samsung.com>
Mon, 29 Oct 2012 04:12:08 +0000 (13:12 +0900)
committerHuisung Kang <hs1218.kang@samsung.com>
Mon, 29 Oct 2012 04:54:22 +0000 (13:54 +0900)
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 <t_h.kim@samsung.com>
Signed-off-by: Huisung Kang <hs1218.kang@samsung.com>
component/video/dec/Exynos_OMX_Vdec.c
component/video/dec/h264/Exynos_OMX_H264dec.c
component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c
component/video/dec/vp8/Exynos_OMX_Vp8dec.c
include/exynos/Exynos_OMX_Def.h

index fb136f70ff1691483906902747bdd0f2dcd0599f..0bc1695bbad1ce9b9423d3ff40bddfb7614cbeb2 100644 (file)
@@ -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);
             }
index 2868d8b41e8ecbb4df9bcaec6621d3090ac9fc47..a681b557f8eb7d5545efc5144892ef2eb90a8e46 100644 (file)
@@ -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);
index 5a220558ec8d241ac1d1bb68bdd25da09b49383e..1e6f36ad4ad58b86fb72af78cf9276ce9807b2d2 100644 (file)
@@ -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);
index c14ec9d08f3dc11ec004a21d1ef9a0a0dcb8126b..cfb57ca8ce14b6931f4ce0e2c6b78e65292247e0 100644 (file)
@@ -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);
index da699d46953512e48d71d7a5f951d9b15ef9b478..48b0ea3e7e0aa75fa0ab7f0e974371204b5bfa01 100644 (file)
@@ -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