video_dec: Limit the number of added minUndequeuedBufs
authorSeungBeom Kim <sbcrux.kim@samsung.com>
Mon, 30 Mar 2015 15:46:38 +0000 (17:46 +0200)
committerGerrit Code Review <gerrit@cyanogenmod.org>
Tue, 31 Mar 2015 17:19:13 +0000 (17:19 +0000)
We try to allocate more memory than the memory size reserved in the
case of DRM play.

Backported-from: hardware/samsung_slsi/exynos5

Change-Id: I906ebd4fed95a860ef72176ee63e4a6a65c982b9
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
component/video/dec/Exynos_OMX_Vdec.h
component/video/dec/Exynos_OMX_VdecControl.c

index 70866e9dcf017ec481c20cba665c28e107082bfb..5f7e938c376919a744b3232dfd87e5b308fd6e99 100644 (file)
@@ -65,6 +65,8 @@
 
 #define MAX_INPUTBUFFER_NUM_DYNAMIC         0 /* Dynamic number of metadata buffer */
 
+#define MAX_DISPLAY_EXTRA_BUFFER            2
+
 typedef struct
 {
     void *pAddrY;
index 5c0fe429c68406491861ce76e7291d2ce55f6ea1..c29666ffa197ba2e9bb08a39fec71f19c89791cd 100644 (file)
@@ -1249,9 +1249,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;
 
@@ -1272,7 +1273,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;
         }