From c40b6cc54765030d29acb54bd957c38f633cd5ea Mon Sep 17 00:00:00 2001 From: Jamie Gennis Date: Thu, 4 Aug 2011 14:04:46 -0700 Subject: Reduce buffer count in Android native buffer mode This change makes nBufferCountMin and nBufferCountActual be 1 for the output port of video decoders that are in Android native buffer mode. Because the decode is done to internally allocated buffers, which are then copied to the Gralloc buffer only one buffer is needed. Change-Id: I157d0d6c6f66ee39f204c6c8871ef08e6d13f9d6 Bug: 5091988 --- sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c | 11 +++++++++++ sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.h | 3 +++ 2 files changed, 14 insertions(+) (limited to 'sec_mm') diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c b/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c index 6dd72a1..30a1acb 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c +++ b/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c @@ -1208,6 +1208,17 @@ OMX_ERRORTYPE SEC_OMX_VideoDecodeSetParameter( } ret = enableAndroidNativeBuffer(hComponent, ComponentParameterStructure); + if (ret == OMX_ErrorNone) { + SEC_OMX_BASECOMPONENT *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; + SEC_OMX_BASEPORT *pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX]; + if (pSECPort->bUseAndroidNativeBuffer) { + pSECPort->portDefinition.nBufferCountActual = ANDROID_MAX_VIDEO_OUTPUTBUFFER_NUM; + pSECPort->portDefinition.nBufferCountMin = ANDROID_MAX_VIDEO_OUTPUTBUFFER_NUM; + } else { + pSECPort->portDefinition.nBufferCountActual = MAX_VIDEO_OUTPUTBUFFER_NUM; + pSECPort->portDefinition.nBufferCountMin = MAX_VIDEO_OUTPUTBUFFER_NUM; + } + } } break; case OMX_IndexParamUseAndroidNativeBuffer: diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.h b/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.h index b7f71da..d9e9d9e 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.h +++ b/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.h @@ -48,6 +48,9 @@ #define INPUT_PORT_SUPPORTFORMAT_NUM_MAX 1 #define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX 3 +#ifdef USE_ANDROID_EXTENSION +#define ANDROID_MAX_VIDEO_OUTPUTBUFFER_NUM 1 +#endif typedef struct { -- cgit v1.1