exynos_omx: multi_thread: Fix bug for video encode tests.
authorSeungBeom Kim <sbcrux.kim@samsung.com>
Fri, 10 Oct 2014 06:05:34 +0000 (15:05 +0900)
committerLajos Molnar <lajos@google.com>
Tue, 14 Oct 2014 00:28:40 +0000 (17:28 -0700)
If the output buffer that has been entered is invalid,
OMX component may experience problems in Flush operation.
This patch performs the following actions.
If invalid output buffer has been entered in the codec setup process, OMX Component will return an error.

Bug: 17785600
Bug: 17811083
Change-Id: Ida0939fae2b7102ab87d5242c8c71e732aba10a2
Signed-off-by: SeungBeom Kim <sbcrux.kim@samsung.com>
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

index ee605009532e2c5d8833fcfedb73f0075c59c15f..518ed7c1ae2d678fc2d45fc0bb30113c57878462 100644 (file)
@@ -1008,6 +1008,7 @@ OMX_ERRORTYPE H264CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
         /*************/
         /*    TBD    */
         /*************/
+        ExynosVideoErrorType codecReturn = VIDEO_ERROR_NONE;
         ExynosVideoPlane plane;
         for (i = 0; i < pExynosOutputPort->portDefinition.nBufferCountActual; i++) {
             plane.addr = pExynosOutputPort->extendBufferHeader[i].OMXBufferHeader->pBuffer;
@@ -1018,8 +1019,13 @@ OMX_ERRORTYPE H264CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
                 ret = OMX_ErrorInsufficientResources;
                 goto EXIT;
             }
-            pOutbufOps->Enqueue(hMFCHandle, (unsigned char **)&pExynosOutputPort->extendBufferHeader[i].OMXBufferHeader->pBuffer,
+            codecReturn = pOutbufOps->Enqueue(hMFCHandle, (unsigned char **)&pExynosOutputPort->extendBufferHeader[i].OMXBufferHeader->pBuffer,
                                    (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL);
+            if (codecReturn != VIDEO_ERROR_NONE) {
+                Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Output buffer that has been entered is invalid.");
+                ret = OMX_ErrorUndefined;
+                goto EXIT;
+            }
         }
     }
 
@@ -1735,6 +1741,9 @@ OMX_ERRORTYPE Exynos_H264Enc_SrcIn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_
     }
     if (pH264Enc->hMFCH264Handle.bConfiguredMFCDst == OMX_FALSE) {
         ret = H264CodecDstSetup(pOMXComponent);
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
     }
 
     if (pVideoEnc->configChange == OMX_TRUE) {
index e915304a470ee2e7b047b2621333fa4614cd8139..98480f85efc2081522588929f29e3ad5a8561ca0 100644 (file)
@@ -1136,10 +1136,11 @@ OMX_ERRORTYPE Mpeg4CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
                                 (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL);
         }
     } else if ((pExynosOutputPort->bufferProcessType & BUFFER_SHARE) == BUFFER_SHARE) {
-        /* Register input buffer */
+        /* Register output buffer */
         /*************/
         /*    TBD    */
         /*************/
+        ExynosVideoErrorType codecReturn = VIDEO_ERROR_NONE;
         ExynosVideoPlane plane;
         for (i = 0; i < pExynosOutputPort->portDefinition.nBufferCountActual; i++) {
             plane.addr = pExynosOutputPort->extendBufferHeader[i].OMXBufferHeader->pBuffer;
@@ -1150,8 +1151,13 @@ OMX_ERRORTYPE Mpeg4CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent)
                 ret = OMX_ErrorInsufficientResources;
                 goto EXIT;
             }
-            pOutbufOps->Enqueue(hMFCHandle, (unsigned char **)&pExynosOutputPort->extendBufferHeader[i].OMXBufferHeader->pBuffer,
+            codecReturn = pOutbufOps->Enqueue(hMFCHandle, (unsigned char **)&pExynosOutputPort->extendBufferHeader[i].OMXBufferHeader->pBuffer,
                                    (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, NULL);
+            if (codecReturn != VIDEO_ERROR_NONE) {
+                Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Output buffer that has been entered is invalid.");
+                ret = OMX_ErrorUndefined;
+                goto EXIT;
+            }
         }
     }
 
@@ -1933,6 +1939,9 @@ OMX_ERRORTYPE Exynos_Mpeg4Enc_SrcIn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX
     }
     if (pMpeg4Enc->hMFCMpeg4Handle.bConfiguredMFCDst == OMX_FALSE) {
         ret = Mpeg4CodecDstSetup(pOMXComponent);
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
     }
 
     if (pVideoEnc->configChange == OMX_TRUE) {