exynos_omx: multi_thread: Limit the number of added minUndequeuedBufs.
authorSeungBeom Kim <sbcrux.kim@samsung.com>
Tue, 22 Jul 2014 02:29:07 +0000 (11:29 +0900)
committerLajos Molnar <lajos@google.com>
Wed, 30 Jul 2014 01:00:13 +0000 (18:00 -0700)
The case of DRM Play,
Root cause is try to allocate more memory than the memory size reserved.

Bug: 13655631

Change-Id: Ib3799026a6fce87ea22fb680e02cd20402a8ce59
Signed-off-by: SeungBeom Kim <sbcrux.kim@samsung.com>
exynos_omx/openmax/exynos_omx/component/video/dec/Exynos_OMX_Vdec.h
exynos_omx/openmax/exynos_omx/component/video/dec/Exynos_OMX_VdecControl.c

index ac78794c109d6880689fcba8b09204ac4d9abfb8..eba0167d7d822ebe799fc59ac432a400c4f5a7f7 100644 (file)
@@ -62,6 +62,8 @@
 
 #define MAX_OUTPUTBUFFER_NUM_DYNAMIC        0 /* Dynamic number of metadata buffer */
 
+#define MAX_DISPLAY_EXTRA_BUFFER            2
+
 typedef struct
 {
     void *pAddrY;
index cd97b44cb4b17a129df82a2a56372b6c3f33f3e3..63ee7ea8c7da2fc0b54205efd38e7074798cad11 100644 (file)
@@ -1208,9 +1208,10 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeSetParameter(
         break;
     case OMX_IndexParamPortDefinition:
     {
-        OMX_PARAM_PORTDEFINITIONTYPE *pPortDefinition = (OMX_PARAM_PORTDEFINITIONTYPE *)ComponentParameterStructure;
-        OMX_U32                       portIndex = pPortDefinition->nPortIndex;
-        EXYNOS_OMX_BASEPORT             *pExynosPort;
+        OMX_PARAM_PORTDEFINITIONTYPE  *pPortDefinition = (OMX_PARAM_PORTDEFINITIONTYPE *)ComponentParameterStructure;
+        EXYNOS_OMX_VIDEODEC_COMPONENT *pVideoDec = (EXYNOS_OMX_VIDEODEC_COMPONENT *)pExynosComponent->hComponentHandle;
+        OMX_U32                        portIndex = pPortDefinition->nPortIndex;
+        EXYNOS_OMX_BASEPORT           *pExynosPort;
         OMX_U32 width, height, size;
         OMX_U32 realWidth, realHeight;
 
@@ -1231,7 +1232,9 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeSetParameter(
                 goto EXIT;
             }
         }
-        if (pPortDefinition->nBufferCountActual < pExynosPort->portDefinition.nBufferCountMin) {
+        if ((pPortDefinition->nBufferCountActual < pExynosPort->portDefinition.nBufferCountMin) ||
+            ((pVideoDec->bDRMPlayerMode == OMX_TRUE) &&
+             (pPortDefinition->nBufferCountActual > (pExynosPort->portDefinition.nBufferCountMin + MAX_DISPLAY_EXTRA_BUFFER)))) {
             ret = OMX_ErrorBadParameter;
             goto EXIT;
         }