exynos_omx: multi_thread: Support EOSBehavior.
authorSeungBeom Kim <sbcrux.kim@samsung.com>
Wed, 16 Jan 2013 06:23:19 +0000 (15:23 +0900)
committerRom Lemarchand <romlem@google.com>
Tue, 26 Feb 2013 17:33:03 +0000 (09:33 -0800)
Support EOSBehavior for testEOSBehaviorH263 & testEOSBehaviorH264.

Bug: 7961269

Change-Id: I13f93b2bfd01fb5c0678da3b0c9b9de7f4a863ee
Signed-off-by: SeungBeom Kim <sbcrux.kim@samsung.com>
13 files changed:
exynos_omx/codecs/exynos_codecs/video/exynos5/mfc_v4l2/Android.mk
exynos_omx/codecs/exynos_codecs/video/exynos5/mfc_v4l2/dec/src/ExynosVideoDecoder.c
exynos_omx/openmax/exynos_omx/component/common/Exynos_OMX_Basecomponent.h
exynos_omx/openmax/exynos_omx/component/video/dec/Exynos_OMX_Vdec.c
exynos_omx/openmax/exynos_omx/component/video/dec/Exynos_OMX_VdecControl.c
exynos_omx/openmax/exynos_omx/component/video/dec/h264/Exynos_OMX_H264dec.c
exynos_omx/openmax/exynos_omx/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c
exynos_omx/openmax/exynos_omx/component/video/dec/vp8/Exynos_OMX_Vp8dec.c
exynos_omx/openmax/exynos_omx/component/video/enc/Exynos_OMX_Venc.c
exynos_omx/openmax/exynos_omx/component/video/enc/Exynos_OMX_VencControl.c
exynos_omx/openmax/exynos_omx/component/video/enc/h264/Exynos_OMX_H264enc.c
exynos_omx/openmax/exynos_omx/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c
include/videodev2.h

index be5e4f9e1f38b26064f3b5daa2f52b4bb558c83c..8cd824873a789a0c8f0d0eb2b8a43f912f9551df 100644 (file)
@@ -8,7 +8,8 @@ LOCAL_SRC_FILES := \
 
 LOCAL_C_INCLUDES := \
        $(LOCAL_PATH)/include \
-       hardware/samsung_slsi/exynos5/include
+       hardware/samsung_slsi/exynos5/include \
+       hardware/samsung_slsi/exynos5/exynos_omx/openmax/exynos_omx/include/khronos
 
 LOCAL_MODULE := libExynosVideoApi
 LOCAL_MODULE_TAGS := optional
index 6259b0caa0827d373c3edbb66bbb24a3726074f3..9dec8e1c5763041f06cc5fb446664698ce90db2a 100644 (file)
@@ -40,6 +40,7 @@
 
 #include "ExynosVideoApi.h"
 #include "ExynosVideoDec.h"
+#include "OMX_Core.h"
 
 /* #define LOG_NDEBUG 0 */
 #define LOG_TAG "ExynosVideoDecoder"
@@ -1441,6 +1442,12 @@ static ExynosVideoErrorType MFC_Decoder_Enqueue_Inbuf(
             buf.m.planes[i].bytesused = dataSize[i];
     }
 
+    if ((((OMX_BUFFERHEADERTYPE *)pPrivate)->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+        buf.flags |= V4L2_BUF_FLAG_LAST_FRAME;
+        ALOGD("%s: OMX_BUFFERFLAG_EOS => LAST_FRAME: 0x%x", __func__,
+              !!(buf.flags & V4L2_BUF_FLAG_LAST_FRAME));
+    }
+
     if (exynos_v4l2_qbuf(pCtx->hDec, &buf) != 0) {
         ALOGE("%s: Failed to enqueue input buffer", __func__);
         pCtx->pInbuf[buf.index].bQueued = VIDEO_FALSE;
index 9f9ed3d216df1af32475687c34708d841e8e51d5..bf7741e1a27e82f0d84a8c2ae77db4458d131313 100644 (file)
@@ -95,7 +95,8 @@ typedef struct _EXYNOS_OMX_BASECOMPONENT
     OMX_BOOL                    reInputData;
 
     OMX_BOOL bUseFlagEOF;
-    OMX_BOOL bSaveFlagEOS;
+    OMX_BOOL bSaveFlagEOS;    //bSaveFlagEOS is OMX_TRUE, if EOS flag is incoming.
+    OMX_BOOL bBehaviorEOS;    //bBehaviorEOS is OMX_TRUE, if EOS flag with Data are incoming.
 
     /* Check for Old & New OMX Process type switch */
     OMX_BOOL bMultiThreadProcess;
index 2f8b72c1ae43ee1df819410d149a8bcfa4c0e7a6..c40221b4b17b3e661ce851df1d095592b1af9f40 100644 (file)
@@ -127,6 +127,46 @@ OMX_BOOL Exynos_Check_BufferProcess_State(EXYNOS_OMX_BASECOMPONENT *pExynosCompo
     return ret;
 }
 
+OMX_ERRORTYPE Exynos_ResetAllPortConfig(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE                  ret               = OMX_ErrorNone;
+    EXYNOS_OMX_BASECOMPONENT      *pExynosComponent  = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    EXYNOS_OMX_BASEPORT           *pExynosInputPort  = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
+    EXYNOS_OMX_BASEPORT           *pExynosOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX];
+
+    /* Input port */
+    pExynosInputPort->portDefinition.format.video.nFrameWidth = DEFAULT_FRAME_WIDTH;
+    pExynosInputPort->portDefinition.format.video.nFrameHeight= DEFAULT_FRAME_HEIGHT;
+    pExynosInputPort->portDefinition.format.video.nStride = 0; /*DEFAULT_FRAME_WIDTH;*/
+    pExynosInputPort->portDefinition.format.video.nSliceHeight = 0;
+    pExynosInputPort->portDefinition.nBufferSize = DEFAULT_VIDEO_INPUT_BUFFER_SIZE;
+    pExynosInputPort->portDefinition.format.video.pNativeRender = 0;
+    pExynosInputPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+    pExynosInputPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatUnused;
+    pExynosInputPort->portDefinition.bEnabled = OMX_TRUE;
+    pExynosInputPort->bufferProcessType = BUFFER_SHARE;
+    pExynosInputPort->portWayType = WAY2_PORT;
+
+    /* Output port */
+    pExynosOutputPort->portDefinition.format.video.nFrameWidth = DEFAULT_FRAME_WIDTH;
+    pExynosOutputPort->portDefinition.format.video.nFrameHeight= DEFAULT_FRAME_HEIGHT;
+    pExynosOutputPort->portDefinition.format.video.nStride = 0; /*DEFAULT_FRAME_WIDTH;*/
+    pExynosOutputPort->portDefinition.format.video.nSliceHeight = 0;
+    pExynosOutputPort->portDefinition.nBufferSize = DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE;
+    pExynosOutputPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
+    Exynos_OSAL_Memset(pExynosOutputPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+    Exynos_OSAL_Strcpy(pExynosOutputPort->portDefinition.format.video.cMIMEType, "raw/video");
+    pExynosOutputPort->portDefinition.format.video.pNativeRender = 0;
+    pExynosOutputPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+    pExynosOutputPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
+    pExynosOutputPort->portDefinition.bEnabled = OMX_TRUE;
+    pExynosOutputPort->bufferProcessType = BUFFER_COPY | BUFFER_ANBSHARE;
+    pExynosOutputPort->bIsANBEnabled = OMX_FALSE;
+    pExynosOutputPort->portWayType = WAY2_PORT;
+
+    return ret;
+}
+
 OMX_ERRORTYPE Exynos_Input_CodecBufferToData(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_PTR codecBuffer, EXYNOS_OMX_DATA *pData)
 {
     OMX_ERRORTYPE                  ret = OMX_ErrorNone;
@@ -394,9 +434,9 @@ OMX_BOOL Exynos_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_
 
         if ((srcInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
             Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "bSaveFlagEOS : OMX_TRUE");
-            srcInputData->dataLen = 0;
-            srcInputData->remainDataLen = 0;
             pExynosComponent->bSaveFlagEOS = OMX_TRUE;
+            if (srcInputData->dataLen != 0)
+                pExynosComponent->bBehaviorEOS = OMX_TRUE;
         }
 
         if (pExynosComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) {
@@ -1008,6 +1048,9 @@ OMX_ERRORTYPE Exynos_OMX_BufferProcess_Terminate(OMX_HANDLETYPE hComponent)
     Exynos_OSAL_ThreadTerminate(pVideoDec->hDstOutputThread);
     pVideoDec->hDstOutputThread = NULL;
 
+    pExynosComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE;
+    pExynosComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE;
+
 EXIT:
     FunctionOut();
 
@@ -1062,6 +1105,7 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeComponentInit(OMX_IN OMX_HANDLETYPE hCompone
     pExynosComponent->hComponentHandle = (OMX_HANDLETYPE)pVideoDec;
 
     pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+    pExynosComponent->bBehaviorEOS = OMX_FALSE;
     pExynosComponent->bMultiThreadProcess = OMX_TRUE;
 
     /* Input port */
index 432a4a76d978d6e8695e41b5d7b8d1738cd5d298..5aff7b1c5404c9d328d96de7bea033a60dac3589 100644 (file)
@@ -560,6 +560,7 @@ OMX_ERRORTYPE Exynos_OMX_BufferFlush(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 n
             Exynos_OSAL_Memset(pExynosComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
             pExynosComponent->getAllDelayBuffer = OMX_FALSE;
             pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+            pExynosComponent->bBehaviorEOS = OMX_FALSE;
             pExynosComponent->reInputData = OMX_FALSE;
         }
 
@@ -763,7 +764,6 @@ OMX_ERRORTYPE Exynos_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent)
         }
 
         if ((bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
-            bufferHeader->nFilledLen = 0;
             Exynos_OSAL_Log(EXYNOS_LOG_TRACE,"event OMX_BUFFERFLAG_EOS!!!");
             pExynosComponent->pCallbacks->EventHandler(pOMXComponent,
                             pExynosComponent->callbackData,
@@ -809,7 +809,6 @@ OMX_ERRORTYPE Exynos_FlushOutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, E
         }
 
         if ((bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
-            bufferHeader->nFilledLen = 0;
             Exynos_OSAL_Log(EXYNOS_LOG_TRACE,"event OMX_BUFFERFLAG_EOS!!!");
             pExynosComponent->pCallbacks->EventHandler(pOMXComponent,
                             pExynosComponent->callbackData,
@@ -1100,33 +1099,49 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeGetParameter(
             pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX];
             portDefinition = &pExynosPort->portDefinition;
 
-            switch (index) {
-            case supportFormat_0:
-                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
-                portFormat->eColorFormat       = OMX_COLOR_FormatYUV420Planar;
-                portFormat->xFramerate         = portDefinition->format.video.xFramerate;
-                break;
-            case supportFormat_1:
-                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
-                portFormat->eColorFormat       = OMX_COLOR_FormatYUV420SemiPlanar;
-                portFormat->xFramerate         = portDefinition->format.video.xFramerate;
-                break;
-            case supportFormat_2:
-                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
-                portFormat->eColorFormat       = OMX_SEC_COLOR_FormatNV12TPhysicalAddress;
-                portFormat->xFramerate         = portDefinition->format.video.xFramerate;
-                break;
-            case supportFormat_3:
-                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
-                portFormat->eColorFormat       = OMX_SEC_COLOR_FormatNV12Tiled;
-                portFormat->xFramerate         = portDefinition->format.video.xFramerate;
-                break;
-            default:
-                if (index > supportFormat_0) {
-                    ret = OMX_ErrorNoMore;
-                    goto EXIT;
+            if (pExynosPort->bIsANBEnabled == OMX_FALSE) {
+                switch (index) {
+                case supportFormat_0:
+                    portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                    portFormat->eColorFormat       = OMX_COLOR_FormatYUV420Planar;
+                    portFormat->xFramerate         = portDefinition->format.video.xFramerate;
+                    break;
+                case supportFormat_1:
+                    portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                    portFormat->eColorFormat       = OMX_COLOR_FormatYUV420SemiPlanar;
+                    portFormat->xFramerate         = portDefinition->format.video.xFramerate;
+                    break;
+                case supportFormat_2:
+                    portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                    portFormat->eColorFormat       = OMX_SEC_COLOR_FormatNV12TPhysicalAddress;
+                    portFormat->xFramerate         = portDefinition->format.video.xFramerate;
+                    break;
+                case supportFormat_3:
+                    portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                    portFormat->eColorFormat       = OMX_SEC_COLOR_FormatNV12Tiled;
+                    portFormat->xFramerate         = portDefinition->format.video.xFramerate;
+                    break;
+                default:
+                    if (index > supportFormat_0) {
+                        ret = OMX_ErrorNoMore;
+                        goto EXIT;
+                    }
+                    break;
+                }
+            } else {
+                switch (index) {
+                case supportFormat_0:
+                    portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                    portFormat->eColorFormat       = OMX_SEC_COLOR_FormatNV12Tiled;
+                    portFormat->xFramerate         = portDefinition->format.video.xFramerate;
+                    break;
+                default:
+                    if (index > supportFormat_0) {
+                        ret = OMX_ErrorNoMore;
+                        goto EXIT;
+                    }
+                    break;
                 }
-                break;
             }
         }
         ret = OMX_ErrorNone;
index 3a831f0991421c2d1c541899a041d36346e96d49..8be2a22e46c130ac71efa8ecfcbbad22baae9dde 100644 (file)
@@ -1453,6 +1453,7 @@ OMX_ERRORTYPE Exynos_H264Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
     pH264Dec->hMFCH264Handle.bConfiguredMFCDst = OMX_FALSE;
     pExynosComponent->bUseFlagEOF = OMX_TRUE;
     pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+    pExynosComponent->bBehaviorEOS = OMX_FALSE;
 
     /* H.264 Codec Open */
     ret = H264CodecOpen(pH264Dec);
@@ -1617,6 +1618,8 @@ OMX_ERRORTYPE Exynos_H264Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
     }
     H264CodecClose(pH264Dec);
 
+    Exynos_ResetAllPortConfig(pOMXComponent);
+
 EXIT:
     FunctionOut();
 
@@ -1904,6 +1907,11 @@ OMX_ERRORTYPE Exynos_H264Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX
         ((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) {
         Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "displayStatus:%d, nFlags0x%x", displayStatus, pDstOutputData->nFlags);
         pDstOutputData->remainDataLen = 0;
+        if (((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+            (pExynosComponent->bBehaviorEOS == OMX_TRUE)) {
+            pDstOutputData->remainDataLen = bufferGeometry->nFrameWidth * bufferGeometry->nFrameHeight * 3 / 2;
+            pExynosComponent->bBehaviorEOS = OMX_FALSE;
+        }
     } else {
         pDstOutputData->remainDataLen = bufferGeometry->nFrameWidth * bufferGeometry->nFrameHeight * 3 / 2;
     }
index 761b1d2c852216c6f6a525a1a2bb90b80b70d135..d8cf096ef1932b21d3fd8833e5e64030e805634c 100644 (file)
@@ -1589,6 +1589,7 @@ OMX_ERRORTYPE Exynos_Mpeg4Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
     pMpeg4Dec->hMFCMpeg4Handle.bConfiguredMFCDst = OMX_FALSE;
     pExynosComponent->bUseFlagEOF = OMX_TRUE;
     pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+    pExynosComponent->bBehaviorEOS = OMX_FALSE;
 
     /* H.264 Codec Open */
     ret = Mpeg4CodecOpen(pMpeg4Dec);
@@ -1746,6 +1747,8 @@ OMX_ERRORTYPE Exynos_Mpeg4Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
     }
     Mpeg4CodecClose(pMpeg4Dec);
 
+    Exynos_ResetAllPortConfig(pOMXComponent);
+
 EXIT:
     FunctionOut();
 
@@ -2032,6 +2035,11 @@ OMX_ERRORTYPE Exynos_Mpeg4Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OM
         ((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) {
         Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "displayStatus:%d, nFlags0x%x", displayStatus, pDstOutputData->nFlags);
         pDstOutputData->remainDataLen = 0;
+        if (((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+            (pExynosComponent->bBehaviorEOS == OMX_TRUE)) {
+            pDstOutputData->remainDataLen = bufferGeometry->nFrameWidth * bufferGeometry->nFrameHeight * 3 / 2;
+            pExynosComponent->bBehaviorEOS = OMX_FALSE;
+        }
     } else {
         pDstOutputData->remainDataLen = bufferGeometry->nFrameWidth * bufferGeometry->nFrameHeight * 3 / 2;
     }
index e8690e1204fe8629b12363d84692833525414024..eb3f01832d9b8cad131f54638ac50895c24d0489 100644 (file)
@@ -1181,6 +1181,7 @@ OMX_ERRORTYPE Exynos_VP8Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
     pVp8Dec->hMFCVp8Handle.bConfiguredMFCDst = OMX_FALSE;
     pExynosComponent->bUseFlagEOF = OMX_TRUE;
     pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+    pExynosComponent->bBehaviorEOS = OMX_FALSE;
 
     /* H.264 Codec Open */
     ret = VP8CodecOpen(pVp8Dec);
@@ -1338,6 +1339,8 @@ OMX_ERRORTYPE Exynos_VP8Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
     }
     VP8CodecClose(pVp8Dec);
 
+    Exynos_ResetAllPortConfig(pOMXComponent);
+
 EXIT:
     FunctionOut();
 
@@ -1624,6 +1627,11 @@ OMX_ERRORTYPE Exynos_VP8Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_
         ((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) {
         Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "displayStatus:%d, nFlags0x%x", displayStatus, pDstOutputData->nFlags);
         pDstOutputData->remainDataLen = 0;
+        if (((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+            (pExynosComponent->bBehaviorEOS == OMX_TRUE)) {
+            pDstOutputData->remainDataLen = bufferGeometry->nFrameWidth * bufferGeometry->nFrameHeight * 3 / 2;
+            pExynosComponent->bBehaviorEOS = OMX_FALSE;
+        }
     } else {
         pDstOutputData->remainDataLen = bufferGeometry->nFrameWidth * bufferGeometry->nFrameHeight * 3 / 2;
     }
index 22efe3659a1c96c0e878ebf3fc823432da4b464e..86b06c9443a0b7e8c98c39425696cac5c895094f 100644 (file)
@@ -439,9 +439,9 @@ OMX_BOOL Exynos_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_
 
         if ((srcInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
             Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "bSaveFlagEOS : OMX_TRUE");
-            srcInputData->dataLen = 0;
-            srcInputData->remainDataLen = 0;
             pExynosComponent->bSaveFlagEOS = OMX_TRUE;
+            if (srcInputData->dataLen != 0)
+                pExynosComponent->bBehaviorEOS = OMX_TRUE;
         }
 
         if (pExynosComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) {
@@ -1077,6 +1077,9 @@ OMX_ERRORTYPE Exynos_OMX_BufferProcess_Terminate(OMX_HANDLETYPE hComponent)
     Exynos_OSAL_ThreadTerminate(pVideoEnc->hDstOutputThread);
     pVideoEnc->hDstOutputThread = NULL;
 
+    pExynosComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE;
+    pExynosComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE;
+
 EXIT:
     FunctionOut();
 
@@ -1133,6 +1136,7 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeComponentInit(OMX_IN OMX_HANDLETYPE hCompone
     pExynosComponent->hComponentHandle = (OMX_HANDLETYPE)pVideoEnc;
 
     pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+    pExynosComponent->bBehaviorEOS = OMX_FALSE;
 
     pVideoEnc->bFirstInput  = OMX_FALSE;
     pVideoEnc->bFirstOutput = OMX_FALSE;
index 42bcc3872a4f986e23ada0e672ab9873ad6e81e2..aa1315bcbc57b27fdd26b3771419565bb4dd8abe 100644 (file)
@@ -548,6 +548,7 @@ OMX_ERRORTYPE Exynos_OMX_BufferFlush(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 n
             Exynos_OSAL_Memset(pExynosComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
             pExynosComponent->getAllDelayBuffer = OMX_FALSE;
             pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+            pExynosComponent->bBehaviorEOS = OMX_FALSE;
             pExynosComponent->reInputData = OMX_FALSE;
         }
 
@@ -751,7 +752,6 @@ OMX_ERRORTYPE Exynos_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent)
         }
 
         if ((bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
-            bufferHeader->nFilledLen = 0;
             Exynos_OSAL_Log(EXYNOS_LOG_TRACE,"event OMX_BUFFERFLAG_EOS!!!");
             pExynosComponent->pCallbacks->EventHandler(pOMXComponent,
                             pExynosComponent->callbackData,
@@ -797,7 +797,6 @@ OMX_ERRORTYPE Exynos_FlushOutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, E
         }
 
         if ((bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
-            bufferHeader->nFilledLen = 0;
             Exynos_OSAL_Log(EXYNOS_LOG_TRACE,"event OMX_BUFFERFLAG_EOS!!!");
             pExynosComponent->pCallbacks->EventHandler(pOMXComponent,
                             pExynosComponent->callbackData,
index 0806f03cf0f77f50033ca5821a3af8a9d396ebdc..497366ba190e32ac7ab4ffe5ea8bc0f4ca7d9422 100644 (file)
@@ -1541,6 +1541,7 @@ OMX_ERRORTYPE Exynos_H264Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
     pH264Enc->hMFCH264Handle.bConfiguredMFCDst = OMX_FALSE;
     pExynosComponent->bUseFlagEOF = OMX_TRUE;
     pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+    pExynosComponent->bBehaviorEOS = OMX_FALSE;
 
     eColorFormat = pExynosInputPort->portDefinition.format.video.eColorFormat;
     if (pExynosInputPort->bStoreMetaData == OMX_TRUE) {
@@ -1994,10 +1995,14 @@ OMX_ERRORTYPE Exynos_H264Enc_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX
     }
 
     if ((displayStatus == VIDEO_FRAME_STATUS_CHANGE_RESOL) ||
-        ((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) {
+        (((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+         (pExynosComponent->bBehaviorEOS == OMX_FALSE))) {
         Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "%x displayStatus:%d, nFlags0x%x", pExynosComponent, displayStatus, pDstOutputData->nFlags);
         pDstOutputData->remainDataLen = 0;
     }
+    if (((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+        (pExynosComponent->bBehaviorEOS == OMX_TRUE))
+        pExynosComponent->bBehaviorEOS = OMX_FALSE;
 
     ret = OMX_ErrorNone;
 
index c6bafc4709dc7a9b177a4216e0393f9e4550386e..51c20b76e70de19aadf559889e8f6889af96d63f 100644 (file)
@@ -1757,6 +1757,7 @@ OMX_ERRORTYPE Exynos_Mpeg4Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
     pMpeg4Enc->hMFCMpeg4Handle.bConfiguredMFCDst = OMX_FALSE;
     pExynosComponent->bUseFlagEOF = OMX_TRUE;
     pExynosComponent->bSaveFlagEOS = OMX_FALSE;
+    pExynosComponent->bBehaviorEOS = OMX_FALSE;
 
     eColorFormat = pExynosInputPort->portDefinition.format.video.eColorFormat;
     if (pExynosInputPort->bStoreMetaData == OMX_TRUE) {
@@ -2197,10 +2198,14 @@ OMX_ERRORTYPE Exynos_Mpeg4Enc_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OM
     }
 
     if ((displayStatus == VIDEO_FRAME_STATUS_CHANGE_RESOL) ||
-        ((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) {
+        (((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+         (pExynosComponent->bBehaviorEOS == OMX_FALSE))) {
         Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "%x displayStatus:%d, nFlags0x%x", pExynosComponent, displayStatus, pDstOutputData->nFlags);
         pDstOutputData->remainDataLen = 0;
     }
+    if (((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+        (pExynosComponent->bBehaviorEOS == OMX_TRUE))
+        pExynosComponent->bBehaviorEOS = OMX_FALSE;
 
     ret = OMX_ErrorNone;
 
index f3ca644a54660bad4fe354ade24e109a46b8c91d..c1c8cd0ef2bf700da0fd3fec4f71f0b77492b7dd 100644 (file)
@@ -680,6 +680,8 @@ struct v4l2_buffer {
 #define V4L2_BUF_FLAG_NO_CACHE_CLEAN           0x1000
 /* Expects and returns a sync fence */
 #define V4L2_BUF_FLAG_USE_SYNC 0x2000
+/* Buffer is end of stream */
+#define V4L2_BUF_FLAG_LAST_FRAME       0x4000
 
 /*
  *     O V E R L A Y   P R E V I E W