diff options
author | SeungBeom Kim <sbcrux.kim@samsung.com> | 2010-09-29 11:08:19 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-09-29 15:41:31 -0700 |
commit | ccbd21584b7b4f3c9bb4fe9af76add5517a3e0be (patch) | |
tree | b8b04c8b55e0977195dfa2757f406b6d01929c61 /sec_mm | |
parent | 3ceb6909851c661bd8c23c8b62959a4989512d38 (diff) | |
download | device_samsung_crespo-ccbd21584b7b4f3c9bb4fe9af76add5517a3e0be.zip device_samsung_crespo-ccbd21584b7b4f3c9bb4fe9af76add5517a3e0be.tar.gz device_samsung_crespo-ccbd21584b7b4f3c9bb4fe9af76add5517a3e0be.tar.bz2 |
Upload additional feature for full frame search and error detect
this feature is disabled by default.
for using this feature
add "#define FULL_FRAME_SEARCH" in SEC_OMX_H264dec.c, SEC_OMX_Mpeg4dec.c
Change-Id: I6225f7ab5aff4c66f19893a3048bdae721b095d8
Signed-off-by: SeungBeom Kim <sbcrux.kim@samsung.com>
Diffstat (limited to 'sec_mm')
6 files changed, 196 insertions, 114 deletions
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 091ab5d..8cf4241 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 @@ -115,21 +115,21 @@ OMX_ERRORTYPE SEC_OMX_FlushPort(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 portIn if (SEC_OSAL_GetElemNum(&pSECPort->bufferQ) != pSECPort->assignedBufferNum) SEC_OSAL_SetElemNum(&pSECPort->bufferQ, pSECPort->assignedBufferNum); } else { - while(1) { - int cnt; - SEC_OSAL_Get_SemaphoreCount(pSECComponent->pSECPort[portIndex].bufferSemID, &cnt); - if (cnt == 0) - break; - SEC_OSAL_SemaphoreWait(pSECComponent->pSECPort[portIndex].bufferSemID); - } + while(1) { + int cnt; + SEC_OSAL_Get_SemaphoreCount(pSECComponent->pSECPort[portIndex].bufferSemID, &cnt); + if (cnt == 0) + break; + SEC_OSAL_SemaphoreWait(pSECComponent->pSECPort[portIndex].bufferSemID); + } SEC_OSAL_SetElemNum(&pSECPort->bufferQ, 0); } - pSECComponent->processData[portIndex].dataLen = 0; + pSECComponent->processData[portIndex].dataLen = 0; pSECComponent->processData[portIndex].nFlags = 0; - pSECComponent->processData[portIndex].remainDataLen = 0; - pSECComponent->processData[portIndex].timeStamp = 0; - pSECComponent->processData[portIndex].usedDataLen = 0; + pSECComponent->processData[portIndex].remainDataLen = 0; + pSECComponent->processData[portIndex].timeStamp = 0; + pSECComponent->processData[portIndex].usedDataLen = 0; EXIT: FunctionOut(); @@ -196,6 +196,7 @@ OMX_ERRORTYPE SEC_OMX_BufferFlushProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP); SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_TIMESTAMP); pSECComponent->getAllDelayBuffer = OMX_FALSE; + pSECComponent->bSaveFlagEOS = OMX_FALSE; pSECComponent->reInputData = OMX_FALSE; } else if (portIndex == OUTPUT_PORT_INDEX) { pSECComponent->remainOutputData = OMX_FALSE; @@ -266,6 +267,7 @@ OMX_ERRORTYPE SEC_OMX_BufferFlushProcessNoEvent(OMX_COMPONENTTYPE *pOMXComponent SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP); SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_TIMESTAMP); pSECComponent->getAllDelayBuffer = OMX_FALSE; + pSECComponent->bSaveFlagEOS = OMX_FALSE; pSECComponent->remainOutputData = OMX_FALSE; pSECComponent->reInputData = OMX_FALSE; } 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 9586a26..66ddad7 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 @@ -414,22 +414,31 @@ static OMX_ERRORTYPE SEC_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent) FunctionIn(); - if (secOMXInputPort->markType.hMarkTargetComponent != NULL ) { - bufferHeader->hMarkTargetComponent = secOMXInputPort->markType.hMarkTargetComponent; - bufferHeader->pMarkData = secOMXInputPort->markType.pMarkData; - secOMXInputPort->markType.hMarkTargetComponent = NULL; - secOMXInputPort->markType.pMarkData = NULL; - } + if (bufferHeader != NULL) { + if (secOMXInputPort->markType.hMarkTargetComponent != NULL ) { + bufferHeader->hMarkTargetComponent = secOMXInputPort->markType.hMarkTargetComponent; + bufferHeader->pMarkData = secOMXInputPort->markType.pMarkData; + secOMXInputPort->markType.hMarkTargetComponent = NULL; + secOMXInputPort->markType.pMarkData = NULL; + } - if (bufferHeader->hMarkTargetComponent != NULL) { - if (bufferHeader->hMarkTargetComponent == pOMXComponent) { - pSECComponent->pCallbacks->EventHandler(pOMXComponent, - pSECComponent->callbackData, - OMX_EventMark, - 0, 0, bufferHeader->pMarkData); + if (bufferHeader->hMarkTargetComponent != NULL) { + if (bufferHeader->hMarkTargetComponent == pOMXComponent) { + pSECComponent->pCallbacks->EventHandler(pOMXComponent, + pSECComponent->callbackData, + OMX_EventMark, + 0, 0, bufferHeader->pMarkData); + } else { + pSECComponent->propagateMarkType.hMarkTargetComponent = bufferHeader->hMarkTargetComponent; + pSECComponent->propagateMarkType.pMarkData = bufferHeader->pMarkData; + } + } + + if (CHECK_PORT_TUNNELED(secOMXInputPort)) { + OMX_FillThisBuffer(secOMXInputPort->tunneledComponent, bufferHeader); } else { - pSECComponent->propagateMarkType.hMarkTargetComponent = bufferHeader->hMarkTargetComponent; - pSECComponent->propagateMarkType.pMarkData = bufferHeader->pMarkData; + bufferHeader->nFilledLen = 0; + pSECComponent->pCallbacks->EmptyBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader); } } @@ -439,14 +448,6 @@ static OMX_ERRORTYPE SEC_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent) SEC_OSAL_SignalWait(pSECComponent->pauseEvent, DEF_MAX_WAIT_TIME); } - if (bufferHeader != NULL) { - if (CHECK_PORT_TUNNELED(secOMXInputPort)) { - OMX_FillThisBuffer(secOMXInputPort->tunneledComponent, bufferHeader); - } else { - bufferHeader->nFilledLen = 0; - pSECComponent->pCallbacks->EmptyBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader); - } - } dataBuffer->dataValid = OMX_FALSE; dataBuffer->dataLen = 0; dataBuffer->remainDataLen = 0; @@ -518,24 +519,32 @@ static OMX_ERRORTYPE SEC_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent) FunctionIn(); - bufferHeader->nFilledLen = dataBuffer->remainDataLen; - bufferHeader->nOffset = 0; - bufferHeader->nFlags = dataBuffer->nFlags; - bufferHeader->nTimeStamp = dataBuffer->timeStamp; + if (bufferHeader != NULL) { + bufferHeader->nFilledLen = dataBuffer->remainDataLen; + bufferHeader->nOffset = 0; + bufferHeader->nFlags = dataBuffer->nFlags; + bufferHeader->nTimeStamp = dataBuffer->timeStamp; + + if (pSECComponent->propagateMarkType.hMarkTargetComponent != NULL) { + bufferHeader->hMarkTargetComponent = pSECComponent->propagateMarkType.hMarkTargetComponent; + bufferHeader->pMarkData = pSECComponent->propagateMarkType.pMarkData; + pSECComponent->propagateMarkType.hMarkTargetComponent = NULL; + pSECComponent->propagateMarkType.pMarkData = NULL; + } - if (pSECComponent->propagateMarkType.hMarkTargetComponent != NULL) { - bufferHeader->hMarkTargetComponent = pSECComponent->propagateMarkType.hMarkTargetComponent; - bufferHeader->pMarkData = pSECComponent->propagateMarkType.pMarkData; - pSECComponent->propagateMarkType.hMarkTargetComponent = NULL; - pSECComponent->propagateMarkType.pMarkData = NULL; - } + if (bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) { + pSECComponent->pCallbacks->EventHandler(pOMXComponent, + pSECComponent->callbackData, + OMX_EventBufferFlag, + OUTPUT_PORT_INDEX, + bufferHeader->nFlags, NULL); + } - if (bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) { - pSECComponent->pCallbacks->EventHandler(pOMXComponent, - pSECComponent->callbackData, - OMX_EventBufferFlag, - OUTPUT_PORT_INDEX, - bufferHeader->nFlags, NULL); + if (CHECK_PORT_TUNNELED(secOMXOutputPort)) { + OMX_EmptyThisBuffer(secOMXOutputPort->tunneledComponent, bufferHeader); + } else { + pSECComponent->pCallbacks->FillBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader); + } } if ((pSECComponent->currentState == OMX_StatePause) && @@ -544,13 +553,6 @@ static OMX_ERRORTYPE SEC_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent) SEC_OSAL_SignalWait(pSECComponent->pauseEvent, DEF_MAX_WAIT_TIME); } - if (bufferHeader != NULL) { - if (CHECK_PORT_TUNNELED(secOMXOutputPort)) { - OMX_EmptyThisBuffer(secOMXOutputPort->tunneledComponent, bufferHeader); - } else { - pSECComponent->pCallbacks->FillBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader); - } - } /* reset dataBuffer */ dataBuffer->dataValid = OMX_FALSE; dataBuffer->dataLen = 0; @@ -720,9 +722,19 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent) } } else { if ((checkedSize == checkInputStreamLen) && (pSECComponent->bSaveFlagEOS == OMX_TRUE)) { + if ((inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) && + ((inputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG) || + (inputData->dataLen == 0))) { inputData->nFlags |= OMX_BUFFERFLAG_EOS; flagEOF = OMX_TRUE; pSECComponent->bSaveFlagEOS = OMX_FALSE; + } else if ((inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) && + (!(inputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG)) && + (inputData->dataLen != 0)) { + inputData->nFlags = (inputData->nFlags & (~OMX_BUFFERFLAG_EOS)); + flagEOF = OMX_TRUE; + pSECComponent->bSaveFlagEOS = OMX_TRUE; + } } else { inputData->nFlags = (inputUseBuffer->nFlags & (~OMX_BUFFERFLAG_EOS)); } @@ -730,8 +742,8 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent) if(((inputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) && (inputData->dataLen <= 0) && (flagEOF == OMX_TRUE)) { - inputData->dataLen += inputData->previousDataLen; - inputData->remainDataLen += inputData->previousDataLen; + inputData->dataLen = inputData->previousDataLen; + inputData->remainDataLen = inputData->previousDataLen; } } else { /*????????????????????????????????? Error ?????????????????????????????????*/ @@ -912,7 +924,9 @@ OMX_ERRORTYPE SEC_OMX_BufferProcess(OMX_HANDLETYPE hComponent) } SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex); + SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex); ret = pSECComponent->sec_mfc_bufferProcess(pOMXComponent, inputData, outputData); + SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex); if (ret == OMX_ErrorInputDataDecodeYet) 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 c25e18f..34a005d 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 @@ -42,6 +42,7 @@ #include "SEC_OSAL_Log.h" //#define ADD_SPS_PPS_I_FRAME +//#define FULL_FRAME_SEARCH /* H.264 Decoder Supported Levels & profiles */ SEC_OMX_VIDEO_PROFILELEVEL supportedAVCProfileLevels[] ={ @@ -821,10 +822,12 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA } } +#ifndef FULL_FRAME_SEARCH if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) && (pSECComponent->bUseFlagEOF == OMX_FALSE)) { pSECComponent->bUseFlagEOF = OMX_TRUE; } +#endif pSECComponent->timeStamp[pH264Dec->hMFCH264Handle.indexTimestamp] = pInputData->timeStamp; pSECComponent->nFlags[pH264Dec->hMFCH264Handle.indexTimestamp] = pInputData->nFlags; @@ -875,24 +878,51 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA (pSECComponent->getAllDelayBuffer == OMX_TRUE)) { ret = OMX_ErrorInputDataDecodeYet; } - + if(status == MFC_GETOUTBUF_DECODING_ONLY) { /* ret = OMX_ErrorInputDataDecodeYet; */ ret = OMX_ErrorNone; goto EXIT; } +#ifdef FULL_FRAME_SEARCH + if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) && + (pSECComponent->bSaveFlagEOS == OMX_TRUE)) { + pInputData->nFlags |= OMX_BUFFERFLAG_EOS; + pSECComponent->getAllDelayBuffer = OMX_TRUE; + ret = OMX_ErrorInputDataDecodeYet; + } else +#endif + if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) { pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS)); pSECComponent->getAllDelayBuffer = OMX_TRUE; ret = OMX_ErrorInputDataDecodeYet; - } - - if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) { + } else if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) { pSECComponent->getAllDelayBuffer = OMX_FALSE; ret = OMX_ErrorNone; } } else { + pOutputData->timeStamp = pInputData->timeStamp; + pOutputData->nFlags = pInputData->nFlags; + switch(pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) { + case OMX_COLOR_FormatYUV420Planar: + case OMX_COLOR_FormatYUV420SemiPlanar: + pOutputData->dataLen = (bufWidth * bufHeight * 3) / 2; + break; + default: + pOutputData->dataLen = bufWidth * bufHeight * 2; + break; + } + + 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; + } + /* ret = OMX_ErrorUndefined; */ /* ????? */ ret = OMX_ErrorNone; goto EXIT; @@ -914,6 +944,7 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA if (pH264Dec->hMFCH264Handle.bThumbnailMode == OMX_FALSE) #endif { + /* if use Post copy address structure */ SEC_OSAL_Memcpy(pOutBuf, &frameSize, sizeof(frameSize)); SEC_OSAL_Memcpy(pOutBuf + sizeof(frameSize), &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr)); SEC_OSAL_Memcpy(pOutBuf + sizeof(frameSize) + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr)); @@ -954,7 +985,7 @@ OMX_ERRORTYPE SEC_MFC_H264Dec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, SE goto EXIT; } - ret = SEC_MFC_H264_Decode(pOMXComponent, pInputData, pOutputData); + ret = SEC_MFC_H264_Decode(pOMXComponent, pInputData, pOutputData); if (ret != OMX_ErrorNone) { if (ret == OMX_ErrorInputDataDecodeYet) { pOutputData->usedDataLen = 0; 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 212e21f..11d50ed 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 @@ -41,6 +41,8 @@ #define SEC_LOG_OFF #include "SEC_OSAL_Log.h" +//#define FULL_FRAME_SEARCH + /* MPEG4 Decoder Supported Levels & profiles */ SEC_OMX_VIDEO_PROFILELEVEL supportedMPEG4ProfileLevels[] ={ {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level0}, @@ -997,10 +999,12 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT } } +#ifndef FULL_FRAME_SEARCH if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) && (pSECComponent->bUseFlagEOF == OMX_FALSE)) { pSECComponent->bUseFlagEOF = OMX_TRUE; } +#endif pSECComponent->timeStamp[pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp] = pInputData->timeStamp; pSECComponent->nFlags[pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp] = pInputData->nFlags; @@ -1051,24 +1055,51 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT (pSECComponent->getAllDelayBuffer == OMX_TRUE)) { ret = OMX_ErrorInputDataDecodeYet; } - + if (status == MFC_GETOUTBUF_DECODING_ONLY) { /* ret = OMX_ErrorInputDataDecodeYet; */ ret = OMX_ErrorNone; goto EXIT; } +#ifdef FULL_FRAME_SEARCH + if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) && + (pSECComponent->bSaveFlagEOS == OMX_TRUE)) { + pInputData->nFlags |= OMX_BUFFERFLAG_EOS; + pSECComponent->getAllDelayBuffer = OMX_TRUE; + ret = OMX_ErrorInputDataDecodeYet; + } else +#endif + if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) { pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS)); pSECComponent->getAllDelayBuffer = OMX_TRUE; ret = OMX_ErrorInputDataDecodeYet; - } - - if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) { + } else if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) { pSECComponent->getAllDelayBuffer = OMX_FALSE; ret = OMX_ErrorNone; } } else { + pOutputData->timeStamp = pInputData->timeStamp; + pOutputData->nFlags = pInputData->nFlags; + switch(pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) { + case OMX_COLOR_FormatYUV420Planar: + case OMX_COLOR_FormatYUV420SemiPlanar: + pOutputData->dataLen = (bufWidth * bufHeight * 3) / 2; + break; + default: + pOutputData->dataLen = bufWidth * bufHeight * 2; + break; + } + + 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; + } + /* ret = OMX_ErrorUndefined; */ /* ????? */ ret = OMX_ErrorNone; goto EXIT; 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 1ee198e..28b749f 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 @@ -414,22 +414,31 @@ static OMX_ERRORTYPE SEC_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent) FunctionIn(); - if (secOMXInputPort->markType.hMarkTargetComponent != NULL ) { - bufferHeader->hMarkTargetComponent = secOMXInputPort->markType.hMarkTargetComponent; - bufferHeader->pMarkData = secOMXInputPort->markType.pMarkData; - secOMXInputPort->markType.hMarkTargetComponent = NULL; - secOMXInputPort->markType.pMarkData = NULL; - } + if (bufferHeader != NULL) { + if (secOMXInputPort->markType.hMarkTargetComponent != NULL ) { + bufferHeader->hMarkTargetComponent = secOMXInputPort->markType.hMarkTargetComponent; + bufferHeader->pMarkData = secOMXInputPort->markType.pMarkData; + secOMXInputPort->markType.hMarkTargetComponent = NULL; + secOMXInputPort->markType.pMarkData = NULL; + } - if (bufferHeader->hMarkTargetComponent != NULL) { - if (bufferHeader->hMarkTargetComponent == pOMXComponent) { - pSECComponent->pCallbacks->EventHandler(pOMXComponent, - pSECComponent->callbackData, - OMX_EventMark, - 0, 0, bufferHeader->pMarkData); + if (bufferHeader->hMarkTargetComponent != NULL) { + if (bufferHeader->hMarkTargetComponent == pOMXComponent) { + pSECComponent->pCallbacks->EventHandler(pOMXComponent, + pSECComponent->callbackData, + OMX_EventMark, + 0, 0, bufferHeader->pMarkData); + } else { + pSECComponent->propagateMarkType.hMarkTargetComponent = bufferHeader->hMarkTargetComponent; + pSECComponent->propagateMarkType.pMarkData = bufferHeader->pMarkData; + } + } + + if (CHECK_PORT_TUNNELED(secOMXInputPort)) { + OMX_FillThisBuffer(secOMXInputPort->tunneledComponent, bufferHeader); } else { - pSECComponent->propagateMarkType.hMarkTargetComponent = bufferHeader->hMarkTargetComponent; - pSECComponent->propagateMarkType.pMarkData = bufferHeader->pMarkData; + bufferHeader->nFilledLen = 0; + pSECComponent->pCallbacks->EmptyBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader); } } @@ -439,14 +448,6 @@ static OMX_ERRORTYPE SEC_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent) SEC_OSAL_SignalWait(pSECComponent->pauseEvent, DEF_MAX_WAIT_TIME); } - if (bufferHeader != NULL) { - if (CHECK_PORT_TUNNELED(secOMXInputPort)) { - OMX_FillThisBuffer(secOMXInputPort->tunneledComponent, bufferHeader); - } else { - bufferHeader->nFilledLen = 0; - pSECComponent->pCallbacks->EmptyBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader); - } - } dataBuffer->dataValid = OMX_FALSE; dataBuffer->dataLen = 0; dataBuffer->remainDataLen = 0; @@ -518,24 +519,32 @@ static OMX_ERRORTYPE SEC_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent) FunctionIn(); - bufferHeader->nFilledLen = dataBuffer->remainDataLen; - bufferHeader->nOffset = 0; - bufferHeader->nFlags = dataBuffer->nFlags; - bufferHeader->nTimeStamp = dataBuffer->timeStamp; + if (bufferHeader != NULL) { + bufferHeader->nFilledLen = dataBuffer->remainDataLen; + bufferHeader->nOffset = 0; + bufferHeader->nFlags = dataBuffer->nFlags; + bufferHeader->nTimeStamp = dataBuffer->timeStamp; + + if (pSECComponent->propagateMarkType.hMarkTargetComponent != NULL) { + bufferHeader->hMarkTargetComponent = pSECComponent->propagateMarkType.hMarkTargetComponent; + bufferHeader->pMarkData = pSECComponent->propagateMarkType.pMarkData; + pSECComponent->propagateMarkType.hMarkTargetComponent = NULL; + pSECComponent->propagateMarkType.pMarkData = NULL; + } - if (pSECComponent->propagateMarkType.hMarkTargetComponent != NULL) { - bufferHeader->hMarkTargetComponent = pSECComponent->propagateMarkType.hMarkTargetComponent; - bufferHeader->pMarkData = pSECComponent->propagateMarkType.pMarkData; - pSECComponent->propagateMarkType.hMarkTargetComponent = NULL; - pSECComponent->propagateMarkType.pMarkData = NULL; - } + if (bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) { + pSECComponent->pCallbacks->EventHandler(pOMXComponent, + pSECComponent->callbackData, + OMX_EventBufferFlag, + OUTPUT_PORT_INDEX, + bufferHeader->nFlags, NULL); + } - if (bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) { - pSECComponent->pCallbacks->EventHandler(pOMXComponent, - pSECComponent->callbackData, - OMX_EventBufferFlag, - OUTPUT_PORT_INDEX, - bufferHeader->nFlags, NULL); + if (CHECK_PORT_TUNNELED(secOMXOutputPort)) { + OMX_EmptyThisBuffer(secOMXOutputPort->tunneledComponent, bufferHeader); + } else { + pSECComponent->pCallbacks->FillBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader); + } } if ((pSECComponent->currentState == OMX_StatePause) && @@ -543,14 +552,7 @@ static OMX_ERRORTYPE SEC_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent) SEC_OSAL_SignalReset(pSECComponent->pauseEvent); SEC_OSAL_SignalWait(pSECComponent->pauseEvent, DEF_MAX_WAIT_TIME); } - - if (bufferHeader != NULL) { - if (CHECK_PORT_TUNNELED(secOMXOutputPort)) { - OMX_EmptyThisBuffer(secOMXOutputPort->tunneledComponent, bufferHeader); - } else { - pSECComponent->pCallbacks->FillBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader); - } - } + /* reset dataBuffer */ dataBuffer->dataValid = OMX_FALSE; dataBuffer->dataLen = 0; @@ -947,7 +949,9 @@ OMX_ERRORTYPE SEC_OMX_BufferProcess(OMX_HANDLETYPE hComponent) } SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex); + SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex); ret = pSECComponent->sec_mfc_bufferProcess(pOMXComponent, inputData, outputData); + SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex); if (ret == OMX_ErrorInputDataEncodeYet) diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c index fa6ad1a..d8a1ccb 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c +++ b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c @@ -848,7 +848,7 @@ OMX_ERRORTYPE SEC_MFC_H264Enc_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, SE pInputData->dataLen -= pInputData->usedDataLen; pInputData->usedDataLen = 0; - /*pOutputData->usedDataLen = 0;*/ + /* pOutputData->usedDataLen = 0; */ pOutputData->remainDataLen = pOutputData->dataLen - pOutputData->usedDataLen; } |