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 | 106 | pSpsBs = bSubSps ? &pCtx->sSubsetSpsBsInfo [iSpsId] : &pCtx->sSpsBsInfo [iSpsId]; |
| 107 | 107 | pPpsBs = &pCtx->sPpsBsInfo [iPpsId]; |
| 108 | 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 | 110 | "DecodeFrameConstruction(): sps pps size: (%d %d) too large. Failed to parse. \n", pSpsBs->uiSpsBsLen, |
| 111 | 111 | pPpsBs->uiPpsBsLen); |
| 112 | 112 | pCtx->iErrorCode |= dsOutOfMemory; |
| @@ -130,7 +130,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 17 unmodified lines | ||
| 130 | 130 | pNalBs = pCurNal->sNalData.sVclNal.pNalPos; |
| 131 | 131 | pParser->iNalLenInByte [pParser->iNalNum ++] = iNalLen; |
| 132 | 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 | 134 | "DecodeFrameConstruction(): composed output size (%ld) exceeds (%d). Failed to parse. \n", |
| 135 | 135 | (long) (pDstBuf - pParser->pDstBuff + iNalLen), MAX_ACCESS_UNIT_CAPACITY); |
| 136 | 136 | pCtx->iErrorCode |= dsOutOfMemory; |
| @@ -517,8 +517,11 @@ int32_t ExpandBsBuffer (PWelsDecoderContext pCtx, const int kiSrcLen) { · 380 unmodified lines | ||
| 517 | 517 | |
| 518 | 518 | //Realloc sRawData |
| 519 | 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 | 523 | return ERR_INFO_OUT_OF_MEMORY; |
| 524 | + } | |
| 522 | 525 | |
| 523 | 526 | //Calculate and set the bs start and end position |
| 524 | 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 | 542 | if (pCtx->pParam->bParseOnly) { |
| 540 | 543 | //Realloc sSavedData |
| 541 | 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 | 548 | return ERR_INFO_OUT_OF_MEMORY; |
| 549 | + } | |
| 544 | 550 | |
| 545 | 551 | //Copy current buffer status to new buffer |
| 546 | 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 | 2256 | pLayerInfo.pSubsetSps = pShExt->pSubsetSps; |
| 2251 | 2257 | |
| 2252 | 2258 | pCtx->pFmo = &pCtx->sFmoList[iPpsId]; |
| 2253 | − if (!FmoParamUpdate (pCtx->pFmo, pLayerInfo.pSps, pLayerInfo.pPps, &pCtx->iActiveFmoNum, pCtx->pMemAlign)) { | |
| 2254 | − pCtx->iErrorCode |= dsBitstreamError; | |
| 2255 | − WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "DecodeCurrentAccessUnit(), FmoParamUpdate failed, eSliceType: %d.", | |
| 2256 | − pSh->eSliceType); | |
| 2259 | + iRet = FmoParamUpdate (pCtx->pFmo, pLayerInfo.pSps, pLayerInfo.pPps, &pCtx->iActiveFmoNum, pCtx->pMemAlign); | |
| 2260 | + if (ERR_NONE != iRet) { | |
| 2261 | + if (iRet == ERR_INFO_OUT_OF_MEMORY) { | |
| 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 | 2269 | return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_FMO_INIT_FAIL); |
| 2258 | 2270 | } |
| 2259 | 2271 | |