From f0f026d24dd4f38a8a197b78a17a6e6a1f348c16 Mon Sep 17 00:00:00 2001 From: SeungBeom Kim Date: Mon, 30 Mar 2015 17:46:38 +0200 Subject: [PATCH] video_dec: Limit the number of added minUndequeuedBufs 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 --- component/video/dec/Exynos_OMX_Vdec.h | 2 ++ component/video/dec/Exynos_OMX_VdecControl.c | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/component/video/dec/Exynos_OMX_Vdec.h b/component/video/dec/Exynos_OMX_Vdec.h index 70866e9..5f7e938 100644 --- a/component/video/dec/Exynos_OMX_Vdec.h +++ b/component/video/dec/Exynos_OMX_Vdec.h @@ -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; diff --git a/component/video/dec/Exynos_OMX_VdecControl.c b/component/video/dec/Exynos_OMX_VdecControl.c index 5c0fe42..c29666f 100644 --- a/component/video/dec/Exynos_OMX_VdecControl.c +++ b/component/video/dec/Exynos_OMX_VdecControl.c @@ -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; } -- 2.20.1