Showing the changes to codec/decoder/core/src/decoder_core.cpp (1 of 6 files). Show all
Unified · Split
| @@ -106,7 +106,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 105 unmodified lines | |||
| 106 | pSpsBs = bSubSps ? &pCtx->sSubsetSpsBsInfo [iSpsId] : &pCtx->sSpsBsInfo [iSpsId]; | 106 | pSpsBs = bSubSps ? &pCtx->sSubsetSpsBsInfo [iSpsId] : &pCtx->sSpsBsInfo [iSpsId]; |
| 107 | pPpsBs = &pCtx->sPpsBsInfo [iPpsId]; | 107 | pPpsBs = &pCtx->sPpsBsInfo [iPpsId]; |
| 108 | if (pDstBuf - pParser->pDstBuff + pSpsBs->uiSpsBsLen + pPpsBs->uiPpsBsLen >= MAX_ACCESS_UNIT_CAPACITY) { | 108 | if (pDstBuf - pParser->pDstBuff + pSpsBs->uiSpsBsLen + pPpsBs->uiPpsBsLen >= MAX_ACCESS_UNIT_CAPACITY) { |
| 109 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, | 109 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, |
| 110 | "DecodeFrameConstruction(): sps pps size: (%d %d) too large. Failed to parse. \n", pSpsBs->uiSpsBsLen, | 110 | "DecodeFrameConstruction(): sps pps size: (%d %d) too large. Failed to parse. \n", pSpsBs->uiSpsBsLen, |
| 111 | pPpsBs->uiPpsBsLen); | 111 | pPpsBs->uiPpsBsLen); |
| 112 | pCtx->iErrorCode |= dsOutOfMemory; | 112 | pCtx->iErrorCode |= dsOutOfMemory; |
| @@ -130,7 +130,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 17 unmodified lines | |||
| 130 | pNalBs = pCurNal->sNalData.sVclNal.pNalPos; | 130 | pNalBs = pCurNal->sNalData.sVclNal.pNalPos; |
| 131 | pParser->iNalLenInByte [pParser->iNalNum ++] = iNalLen; | 131 | pParser->iNalLenInByte [pParser->iNalNum ++] = iNalLen; |
| 132 | if (pDstBuf - pParser->pDstBuff + iNalLen >= MAX_ACCESS_UNIT_CAPACITY) { | 132 | if (pDstBuf - pParser->pDstBuff + iNalLen >= MAX_ACCESS_UNIT_CAPACITY) { |
| 133 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, | 133 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, |
| 134 | "DecodeFrameConstruction(): composed output size (%ld) exceeds (%d). Failed to parse. \n", | 134 | "DecodeFrameConstruction(): composed output size (%ld) exceeds (%d). Failed to parse. \n", |
| 135 | (long) (pDstBuf - pParser->pDstBuff + iNalLen), MAX_ACCESS_UNIT_CAPACITY); | 135 | (long) (pDstBuf - pParser->pDstBuff + iNalLen), MAX_ACCESS_UNIT_CAPACITY); |
| 136 | pCtx->iErrorCode |= dsOutOfMemory; | 136 | pCtx->iErrorCode |= dsOutOfMemory; |
| @@ -517,8 +517,11 @@ int32_t ExpandBsBuffer (PWelsDecoderContext pCtx, const int kiSrcLen) { · 380 unmodified lines | |||
| 517 | 517 | ||
| 518 | //Realloc sRawData | 518 | //Realloc sRawData |
| 519 | uint8_t* pNewBsBuff = static_cast<uint8_t*> (pMa->WelsMallocz (iNewBuffLen, "pCtx->sRawData.pHead")); | 519 | uint8_t* pNewBsBuff = static_cast<uint8_t*> (pMa->WelsMallocz (iNewBuffLen, "pCtx->sRawData.pHead")); |
| 520 | if (pNewBsBuff == NULL) | 520 | if (pNewBsBuff == NULL) { |
| 521 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "ExpandBsBuffer() Failed for malloc pNewBsBuff (%d)", iNewBuffLen); | ||
| 522 | pCtx->iErrorCode |= dsOutOfMemory; | ||
| 521 | return ERR_INFO_OUT_OF_MEMORY; | 523 | return ERR_INFO_OUT_OF_MEMORY; |
| 524 | } | ||
| 522 | 525 | ||
| 523 | //Calculate and set the bs start and end position | 526 | //Calculate and set the bs start and end position |
| 524 | for (uint32_t i = 0; i <= pCtx->pAccessUnitList->uiActualUnitsNum; i++) { | 527 | for (uint32_t i = 0; i <= pCtx->pAccessUnitList->uiActualUnitsNum; i++) { |
| @@ -539,8 +542,11 @@ int32_t ExpandBsBuffer (PWelsDecoderContext pCtx, const int kiSrcLen) { · 14 unmodified lines | |||
| 539 | if (pCtx->pParam->bParseOnly) { | 542 | if (pCtx->pParam->bParseOnly) { |
| 540 | //Realloc sSavedData | 543 | //Realloc sSavedData |
| 541 | uint8_t* pNewSavedBsBuff = static_cast<uint8_t*> (pMa->WelsMallocz (iNewBuffLen, "pCtx->sSavedData.pHead")); | 544 | uint8_t* pNewSavedBsBuff = static_cast<uint8_t*> (pMa->WelsMallocz (iNewBuffLen, "pCtx->sSavedData.pHead")); |
| 542 | if (pNewSavedBsBuff == NULL) | 545 | if (pNewSavedBsBuff == NULL) { |
| 546 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "ExpandBsBuffer() Failed for malloc pNewSavedBsBuff (%d)", iNewBuffLen); | ||
| 547 | pCtx->iErrorCode |= dsOutOfMemory; | ||
| 543 | return ERR_INFO_OUT_OF_MEMORY; | 548 | return ERR_INFO_OUT_OF_MEMORY; |
| 549 | } | ||
| 544 | 550 | ||
| 545 | //Copy current buffer status to new buffer | 551 | //Copy current buffer status to new buffer |
| 546 | memcpy (pNewSavedBsBuff, pCtx->sSavedData.pHead, pCtx->iMaxBsBufferSizeInByte); | 552 | memcpy (pNewSavedBsBuff, pCtx->sSavedData.pHead, pCtx->iMaxBsBufferSizeInByte); |
| @@ -2250,10 +2256,16 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 1703 unmodified lines | |||
| 2250 | pLayerInfo.pSubsetSps = pShExt->pSubsetSps; | 2256 | pLayerInfo.pSubsetSps = pShExt->pSubsetSps; |
| 2251 | 2257 | ||
| 2252 | pCtx->pFmo = &pCtx->sFmoList[iPpsId]; | 2258 | pCtx->pFmo = &pCtx->sFmoList[iPpsId]; |
| 2253 | if (!FmoParamUpdate (pCtx->pFmo, pLayerInfo.pSps, pLayerInfo.pPps, &pCtx->iActiveFmoNum, pCtx->pMemAlign)) { | 2259 | iRet = FmoParamUpdate (pCtx->pFmo, pLayerInfo.pSps, pLayerInfo.pPps, &pCtx->iActiveFmoNum, pCtx->pMemAlign); |
| 2254 | pCtx->iErrorCode |= dsBitstreamError; | 2260 | if (ERR_NONE != iRet) { |
| 2255 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "DecodeCurrentAccessUnit(), FmoParamUpdate failed, eSliceType: %d.", | 2261 | if (iRet == ERR_INFO_OUT_OF_MEMORY) { |
| 2256 | pSh->eSliceType); | 2262 | pCtx->iErrorCode |= dsOutOfMemory; |
| 2263 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, "DecodeCurrentAccessUnit(), Fmo param alloc failed"); | ||
| 2264 | } else { | ||
| 2265 | pCtx->iErrorCode |= dsBitstreamError; | ||
| 2266 | WelsLog(&(pCtx->sLogCtx), WELS_LOG_WARNING, "DecodeCurrentAccessUnit(), FmoParamUpdate failed, eSliceType: %d.", | ||
| 2267 | pSh->eSliceType); | ||
| 2268 | } | ||
| 2257 | return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_FMO_INIT_FAIL); | 2269 | return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_FMO_INIT_FAIL); |
| 2258 | } | 2270 | } |
| 2259 | 2271 | ||