diff options
author | SeungBeom Kim <sbcrux.kim@samsung.com> | 2010-10-14 20:51:50 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2010-10-26 14:18:46 -0700 |
commit | b9afb44c2961fb6d722b9d45dee2140ce7b93b20 (patch) | |
tree | 3bf583e76caa6f289ad4f12b012c781036003f5d /sec_mm/sec_omx | |
parent | 3c4232c3b525d78ccb1e1058ef6f425afc9ebe55 (diff) | |
download | device_samsung_crespo-b9afb44c2961fb6d722b9d45dee2140ce7b93b20.zip device_samsung_crespo-b9afb44c2961fb6d722b9d45dee2140ce7b93b20.tar.gz device_samsung_crespo-b9afb44c2961fb6d722b9d45dee2140ce7b93b20.tar.bz2 |
SEC_OMX Bug Fix
This patch is to fix the following bug: http://b/issue?id=3127000
- Make up for Flush Buffer Number Count
- Bug fix is EOS Frame timestamp error and player hang
Change-Id: I6ea46a0b8e91381216a7d2bc0e4bd20e3391f628
Signed-off-by: SeungBeom Kim <sbcrux.kim@samsung.com>
Diffstat (limited to 'sec_mm/sec_omx')
8 files changed, 91 insertions, 25 deletions
diff --git a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Basecomponent.c b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Basecomponent.c index a761045..d1b224f 100644 --- a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Basecomponent.c +++ b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Basecomponent.c @@ -585,7 +585,7 @@ static OMX_ERRORTYPE SEC_SetPortFlush(SEC_OMX_BASECOMPONENT *pSECComponent, OMX_ OMX_ERRORTYPE ret = OMX_ErrorNone; SEC_OMX_BASEPORT *pSECPort = NULL; OMX_U32 portIndex = nParam; - OMX_U16 i = 0, cnt = 0; + OMX_U16 i = 0, cnt = 0, index = 0; if ((pSECComponent->currentState == OMX_StateExecuting) || @@ -599,7 +599,14 @@ static OMX_ERRORTYPE SEC_SetPortFlush(SEC_OMX_BASECOMPONENT *pSECComponent, OMX_ /********************* * need flush event set ????? **********************/ - + cnt = (portIndex == ALL_PORT_INDEX ) ? ALL_PORT_NUM : 1; + for (i = 0; i < cnt; i++) { + if (portIndex == ALL_PORT_INDEX) + index = i; + else + index = portIndex; + pSECComponent->pSECPort[index].bIsPortFlushed = OMX_TRUE; + } } else { ret = OMX_ErrorIncorrectStateOperation; goto EXIT; @@ -676,10 +683,12 @@ static OMX_ERRORTYPE SEC_SetPortDisable(SEC_OMX_BASECOMPONENT *pSECComponent, OM goto EXIT; } pSECPort->portState = OMX_StateLoaded; + pSECPort->bIsPortDisabled = OMX_TRUE; } } else { pSECPort = &pSECComponent->pSECPort[portIndex]; pSECPort->portState = OMX_StateLoaded; + pSECPort->bIsPortDisabled = OMX_TRUE; } ret = OMX_ErrorNone; diff --git a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.c b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.c index 8cf4241..0e0f7ea 100644 --- a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.c +++ b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.c @@ -56,9 +56,7 @@ OMX_ERRORTYPE SEC_OMX_FlushPort(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 portIn FunctionIn(); pSECPort = &pSECComponent->pSECPort[portIndex]; - flushNum = SEC_OSAL_GetElemNum(&pSECPort->bufferQ); - - while ((flushNum--) > 0) { + while (SEC_OSAL_GetElemNum(&pSECPort->bufferQ) > 0) { SEC_OSAL_Get_SemaphoreCount(pSECComponent->pSECPort[portIndex].bufferSemID, &semValue); if (semValue == 0) SEC_OSAL_SemaphorePost(pSECComponent->pSECPort[portIndex].bufferSemID); @@ -78,7 +76,10 @@ OMX_ERRORTYPE SEC_OMX_FlushPort(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 portIn SEC_OSAL_Free(message); message = NULL; } else if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) { + SEC_OSAL_Log(SEC_LOG_ERROR, "Tunneled mode is not working, Line:%d", __LINE__); + ret = OMX_ErrorNotImplemented; SEC_OSAL_Queue(&pSECPort->bufferQ, pSECPort); + goto EXIT; } else { if (portIndex == OUTPUT_PORT_INDEX) { pSECComponent->pCallbacks->FillBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader); @@ -171,8 +172,6 @@ OMX_ERRORTYPE SEC_OMX_BufferFlushProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S else portIndex = nPortIndex; - pSECComponent->pSECPort[portIndex].bIsPortFlushed = OMX_TRUE; - SEC_OSAL_SignalSet(pSECComponent->pauseEvent); flushBuffer = &pSECComponent->secDataBuffer[portIndex]; @@ -193,8 +192,9 @@ OMX_ERRORTYPE SEC_OMX_BufferFlushProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S if (portIndex == INPUT_PORT_INDEX) { pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE; + pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE; SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP); - SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_TIMESTAMP); + SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS); pSECComponent->getAllDelayBuffer = OMX_FALSE; pSECComponent->bSaveFlagEOS = OMX_FALSE; pSECComponent->reInputData = OMX_FALSE; @@ -264,8 +264,9 @@ OMX_ERRORTYPE SEC_OMX_BufferFlushProcessNoEvent(OMX_COMPONENTTYPE *pOMXComponent if (portIndex == INPUT_PORT_INDEX) { pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE; + pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE; SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP); - SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_TIMESTAMP); + SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS); pSECComponent->getAllDelayBuffer = OMX_FALSE; pSECComponent->bSaveFlagEOS = OMX_FALSE; pSECComponent->remainOutputData = OMX_FALSE; @@ -477,6 +478,18 @@ OMX_ERRORTYPE SEC_OMX_PortDisableProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S SEC_OSAL_MutexUnlock(flushBuffer->bufferMutex); pSECComponent->pSECPort[portIndex].bIsPortFlushed = OMX_FALSE; + + if (portIndex == INPUT_PORT_INDEX) { + pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE; + pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE; + SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP); + SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS); + pSECComponent->getAllDelayBuffer = OMX_FALSE; + pSECComponent->bSaveFlagEOS = OMX_FALSE; + pSECComponent->reInputData = OMX_FALSE; + } else if (portIndex == OUTPUT_PORT_INDEX) { + pSECComponent->remainOutputData = OMX_FALSE; + } } for(i = 0; i < cnt; i++) { @@ -486,6 +499,7 @@ OMX_ERRORTYPE SEC_OMX_PortDisableProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S portIndex = nPortIndex; ret = SEC_OMX_DisablePort(pOMXComponent, portIndex); + pSECComponent->pSECPort[portIndex].bIsPortDisabled = OMX_FALSE; if (ret == OMX_ErrorNone) { pSECComponent->pCallbacks->EventHandler(pOMXComponent, pSECComponent->callbackData, @@ -564,7 +578,9 @@ OMX_ERRORTYPE SEC_OMX_EmptyThisBuffer( pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX]; if ((!CHECK_PORT_ENABLED(pSECPort)) || - (pSECComponent->transientState == SEC_OMX_TransStateExecutingToIdle && + ((CHECK_PORT_BEING_FLUSHED(pSECPort) || CHECK_PORT_BEING_DISABLED(pSECPort)) && + (!CHECK_PORT_TUNNELED(pSECPort) || !CHECK_PORT_BUFFER_SUPPLIER(pSECPort))) || + ((pSECComponent->transientState == SEC_OMX_TransStateExecutingToIdle) && (CHECK_PORT_TUNNELED(pSECPort) && !CHECK_PORT_BUFFER_SUPPLIER(pSECPort)))) { ret = OMX_ErrorIncorrectStateOperation; goto EXIT; @@ -659,7 +675,9 @@ OMX_ERRORTYPE SEC_OMX_FillThisBuffer( pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX]; if ((!CHECK_PORT_ENABLED(pSECPort)) || - (pSECComponent->transientState == SEC_OMX_TransStateExecutingToIdle && + ((CHECK_PORT_BEING_FLUSHED(pSECPort) || CHECK_PORT_BEING_DISABLED(pSECPort)) && + (!CHECK_PORT_TUNNELED(pSECPort) || !CHECK_PORT_BUFFER_SUPPLIER(pSECPort))) || + ((pSECComponent->transientState == SEC_OMX_TransStateExecutingToIdle) && (CHECK_PORT_TUNNELED(pSECPort) && !CHECK_PORT_BUFFER_SUPPLIER(pSECPort)))) { ret = OMX_ErrorIncorrectStateOperation; goto EXIT; @@ -771,6 +789,7 @@ OMX_ERRORTYPE SEC_OMX_Port_Constructor(OMX_HANDLETYPE hComponent) pSECInputPort->assignedBufferNum = 0; pSECInputPort->portState = OMX_StateMax; pSECInputPort->bIsPortFlushed = OMX_FALSE; + pSECInputPort->bIsPortDisabled = OMX_FALSE; pSECInputPort->tunneledComponent = NULL; pSECInputPort->tunneledPort = 0; pSECInputPort->tunnelBufferNum = 0; @@ -860,6 +879,7 @@ OMX_ERRORTYPE SEC_OMX_Port_Constructor(OMX_HANDLETYPE hComponent) pSECOutputPort->assignedBufferNum = 0; pSECOutputPort->portState = OMX_StateMax; pSECOutputPort->bIsPortFlushed = OMX_FALSE; + pSECOutputPort->bIsPortDisabled = OMX_FALSE; pSECOutputPort->tunneledComponent = NULL; pSECOutputPort->tunneledPort = 0; pSECOutputPort->tunnelBufferNum = 0; diff --git a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.h b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.h index 820ac63..f38226b 100644 --- a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.h +++ b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.h @@ -59,6 +59,7 @@ typedef struct _SEC_OMX_BASEPORT OMX_HANDLETYPE unloadedResource; OMX_BOOL bIsPortFlushed; + OMX_BOOL bIsPortDisabled; OMX_MARKTYPE markType; /* Tunnel Info */ 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 66ddad7..48705c1 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 @@ -468,6 +468,7 @@ OMX_ERRORTYPE SEC_InputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent) SEC_OMX_BASEPORT *pSECPort = NULL; SEC_OMX_DATABUFFER *dataBuffer = NULL; SEC_OMX_MESSAGE* message = NULL; + SEC_OMX_DATABUFFER *inputUseBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX]; FunctionIn(); @@ -479,10 +480,12 @@ OMX_ERRORTYPE SEC_InputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent) goto EXIT; } else { SEC_OSAL_SemaphoreWait(pSECPort->bufferSemID); + SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex); if (dataBuffer->dataValid != OMX_TRUE) { message = (SEC_OMX_MESSAGE *)SEC_OSAL_Dequeue(&pSECPort->bufferQ); if (message == NULL) { ret = OMX_ErrorUndefined; + SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex); goto EXIT; } @@ -500,6 +503,7 @@ OMX_ERRORTYPE SEC_InputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent) if (dataBuffer->allocSize <= dataBuffer->dataLen) SEC_OSAL_Log(SEC_LOG_WARNING, "Input Buffer Full, Check input buffer size! allocSize:%d, dataLen:%d", dataBuffer->allocSize, dataBuffer->dataLen); } + SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex); ret = OMX_ErrorNone; } EXIT: @@ -574,6 +578,7 @@ OMX_ERRORTYPE SEC_OutputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent) SEC_OMX_BASEPORT *pSECPort = NULL; SEC_OMX_DATABUFFER *dataBuffer = NULL; SEC_OMX_MESSAGE *message = NULL; + SEC_OMX_DATABUFFER *outputUseBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX]; FunctionIn(); @@ -585,10 +590,12 @@ OMX_ERRORTYPE SEC_OutputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent) goto EXIT; } else { SEC_OSAL_SemaphoreWait(pSECPort->bufferSemID); + SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex); if (dataBuffer->dataValid != OMX_TRUE) { message = (SEC_OMX_MESSAGE *)SEC_OSAL_Dequeue(&pSECPort->bufferQ); if (message == NULL) { ret = OMX_ErrorUndefined; + SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); goto EXIT; } @@ -606,6 +613,7 @@ OMX_ERRORTYPE SEC_OutputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent) #endif SEC_OSAL_Free(message); } + SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); ret = OMX_ErrorNone; } EXIT: @@ -903,18 +911,25 @@ OMX_ERRORTYPE SEC_OMX_BufferProcess(OMX_HANDLETYPE hComponent) while (SEC_Check_BufferProcess_State(pSECComponent) && !pSECComponent->bExitBufferProcessThread) { SEC_OSAL_SleepMillisec(0); - if (outputUseBuffer->dataValid != OMX_TRUE) { + SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex); + if ((outputUseBuffer->dataValid != OMX_TRUE) && + (!CHECK_PORT_BEING_FLUSHED(secOutputPort))) { + SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); ret = SEC_OutputBufferGetQueue(pSECComponent); if ((ret == OMX_ErrorUndefined) || (secInputPort->portState != OMX_StateIdle) || (secOutputPort->portState != OMX_StateIdle)) { break; } + } else { + SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); } + if (pSECComponent->remainOutputData == OMX_FALSE) { if (pSECComponent->reInputData == OMX_FALSE) { SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex); - if (SEC_Preprocessor_InputData(pOMXComponent) == OMX_FALSE) { + if ((SEC_Preprocessor_InputData(pOMXComponent) == OMX_FALSE) && + (!CHECK_PORT_BEING_FLUSHED(secInputPort))) { SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex); ret = SEC_InputBufferGetQueue(pSECComponent); break; diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c index 4d2944d..5e73b7f 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c +++ b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c @@ -839,7 +839,10 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA if (Check_H264_StartCode(pInputData->dataBuffer, pInputData->dataLen) == OMX_TRUE) { returnCodec = SsbSipMfcDecExe(pH264Dec->hMFCH264Handle.hMFCHandle, oneFrameSize); } else { + pOutputData->timeStamp = pInputData->timeStamp; + pOutputData->nFlags = pInputData->nFlags; returnCodec = MFC_RET_OK; + goto EXIT; } if (returnCodec == MFC_RET_OK) { @@ -918,9 +921,9 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA if ((pSECComponent->bSaveFlagEOS == OMX_TRUE) || (pSECComponent->getAllDelayBuffer == OMX_TRUE) || (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) { - pOutputData->nFlags |= OMX_BUFFERFLAG_EOS; - pSECComponent->getAllDelayBuffer = OMX_FALSE; - pOutputData->dataLen = 0; + pOutputData->nFlags |= OMX_BUFFERFLAG_EOS; + pSECComponent->getAllDelayBuffer = OMX_FALSE; + pOutputData->dataLen = 0; } /* ret = OMX_ErrorUndefined; */ /* ????? */ diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c index 7fac824..5074214 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c +++ b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c @@ -1019,7 +1019,10 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT if (Check_Stream_PrefixCode(pInputData->dataBuffer, pInputData->dataLen, pMpeg4Dec->hMFCMpeg4Handle.codecType) == OMX_TRUE) { returnCodec = SsbSipMfcDecExe(hMFCHandle, oneFrameSize); } else { + pOutputData->timeStamp = pInputData->timeStamp; + pOutputData->nFlags = pInputData->nFlags; returnCodec = MFC_RET_OK; + goto EXIT; } if (returnCodec == MFC_RET_OK) { @@ -1098,15 +1101,15 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT if ((pSECComponent->bSaveFlagEOS == OMX_TRUE) || (pSECComponent->getAllDelayBuffer == OMX_TRUE) || (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) { - pOutputData->nFlags |= OMX_BUFFERFLAG_EOS; - pSECComponent->getAllDelayBuffer = OMX_FALSE; - pOutputData->dataLen = 0; + pOutputData->nFlags |= OMX_BUFFERFLAG_EOS; + pSECComponent->getAllDelayBuffer = OMX_FALSE; + pOutputData->dataLen = 0; } /* ret = OMX_ErrorUndefined; */ /* ????? */ - ret = OMX_ErrorNone; - goto EXIT; - } + ret = OMX_ErrorNone; + goto EXIT; + } /** Fill Output Buffer **/ if (pOutputData->dataLen > 0) diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c b/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c index 28b749f..a6e1a18 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c +++ b/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c @@ -39,7 +39,6 @@ #define SEC_LOG_OFF #include "SEC_OSAL_Log.h" - #define ONE_FRAME_OUTPUT /* only one frame output for Android */ #define S5PC110_ENCODE_IN_DATA_BUFFER /* for Android s5pc110 0copy*/ @@ -468,6 +467,7 @@ OMX_ERRORTYPE SEC_InputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent) SEC_OMX_BASEPORT *pSECPort = NULL; SEC_OMX_DATABUFFER *dataBuffer = NULL; SEC_OMX_MESSAGE* message = NULL; + SEC_OMX_DATABUFFER *inputUseBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX]; FunctionIn(); @@ -479,10 +479,12 @@ OMX_ERRORTYPE SEC_InputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent) goto EXIT; } else { SEC_OSAL_SemaphoreWait(pSECPort->bufferSemID); + SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex); if (dataBuffer->dataValid != OMX_TRUE) { message = (SEC_OMX_MESSAGE *)SEC_OSAL_Dequeue(&pSECPort->bufferQ); if (message == NULL) { ret = OMX_ErrorUndefined; + SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex); goto EXIT; } @@ -500,6 +502,7 @@ OMX_ERRORTYPE SEC_InputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent) #endif SEC_OSAL_Free(message); } + SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex); ret = OMX_ErrorNone; } EXIT: @@ -574,6 +577,7 @@ OMX_ERRORTYPE SEC_OutputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent) SEC_OMX_BASEPORT *pSECPort = NULL; SEC_OMX_DATABUFFER *dataBuffer = NULL; SEC_OMX_MESSAGE *message = NULL; + SEC_OMX_DATABUFFER *outputUseBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX]; FunctionIn(); @@ -585,10 +589,12 @@ OMX_ERRORTYPE SEC_OutputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent) goto EXIT; } else { SEC_OSAL_SemaphoreWait(pSECPort->bufferSemID); + SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex); if (dataBuffer->dataValid != OMX_TRUE) { message = (SEC_OMX_MESSAGE *)SEC_OSAL_Dequeue(&pSECPort->bufferQ); if (message == NULL) { ret = OMX_ErrorUndefined; + SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); goto EXIT; } @@ -602,6 +608,7 @@ OMX_ERRORTYPE SEC_OutputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent) /* dataBuffer->nTimeStamp = dataBuffer->bufferHeader->nTimeStamp; */ SEC_OSAL_Free(message); } + SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); ret = OMX_ErrorNone; } EXIT: @@ -928,18 +935,25 @@ OMX_ERRORTYPE SEC_OMX_BufferProcess(OMX_HANDLETYPE hComponent) while (SEC_Check_BufferProcess_State(pSECComponent) && !pSECComponent->bExitBufferProcessThread) { SEC_OSAL_SleepMillisec(0); - if (outputUseBuffer->dataValid != OMX_TRUE) { + SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex); + if ((outputUseBuffer->dataValid != OMX_TRUE) && + (!CHECK_PORT_BEING_FLUSHED(secOutputPort))) { + SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); ret = SEC_OutputBufferGetQueue(pSECComponent); if ((ret == OMX_ErrorUndefined) || (secInputPort->portState != OMX_StateIdle) || (secOutputPort->portState != OMX_StateIdle)) { break; } + } else { + SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); } + if (pSECComponent->remainOutputData == OMX_FALSE) { if (pSECComponent->reInputData == OMX_FALSE) { SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex); - if (SEC_Preprocessor_InputData(pOMXComponent) == OMX_FALSE) { + if ((SEC_Preprocessor_InputData(pOMXComponent) == OMX_FALSE) && + (!CHECK_PORT_BEING_FLUSHED(secInputPort))) { SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex); ret = SEC_InputBufferGetQueue(pSECComponent); break; diff --git a/sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Macros.h b/sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Macros.h index ff883c1..b3bfda6 100644 --- a/sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Macros.h +++ b/sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Macros.h @@ -55,6 +55,7 @@ #define SEC_TUNNEL_IS_SUPPLIER 0x0002 #define CHECK_PORT_BEING_FLUSHED(port) (port->bIsPortFlushed == OMX_TRUE) +#define CHECK_PORT_BEING_DISABLED(port) (port->bIsPortDisabled == OMX_TRUE) #define CHECK_PORT_ENABLED(port) (port->portDefinition.bEnabled == OMX_TRUE) #define CHECK_PORT_POPULATED(port) (port->portDefinition.bPopulated == OMX_TRUE) #define CHECK_PORT_TUNNELED(port) (port->tunnelFlags & SEC_TUNNEL_ESTABLISHED) |