From e48585236e0fed62f35d3715d4aedf133a0a8a62 Mon Sep 17 00:00:00 2001 From: huili2 Date: Wed, 7 Jan 2015 22:34:55 -0800 Subject: [PATCH] prevent error propagation for parse only when frame is not complete --- codec/decoder/core/src/decoder_core.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/codec/decoder/core/src/decoder_core.cpp b/codec/decoder/core/src/decoder_core.cpp index 4f434eb8..2bc2f81b 100644 --- a/codec/decoder/core/src/decoder_core.cpp +++ b/codec/decoder/core/src/decoder_core.cpp @@ -1762,7 +1762,8 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI iErr = DecodeCurrentAccessUnit (pCtx, ppDst, pDstInfo); if (pCtx->bParseOnly) { - if ((dsErrorFree == pCtx->iErrorCode) && ((uint32_t) pCtx->iTotalNumMbRec == pCtx->pSps->iMbHeight * pCtx->pSps->iMbWidth)) { + if ((dsErrorFree == pCtx->iErrorCode) + && ((uint32_t) pCtx->iTotalNumMbRec == pCtx->pSps->iMbHeight * pCtx->pSps->iMbWidth)) { SParserBsInfo* pParser = pCtx->pParserBsInfo; uint8_t* pDstBuf = pParser->pDstBuff; SNalUnit* pCurNal = NULL; @@ -2128,6 +2129,10 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf pCtx->pDec->bIsComplete = bAllRefComplete; if (!pCtx->pDec->bIsComplete) { // Ref pictures ECed, result in ECed pCtx->iErrorCode |= dsDataErrorConcealed; + } else if (pCtx->bParseOnly) { + pCtx->pDec->bIsComplete = (pCtx->iTotalNumMbRec == pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight); + if (!pCtx->pDec->bIsComplete) + return -1; } // A dq layer decoded here @@ -2165,8 +2170,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf } if (!pCtx->bParseOnly) ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel, - pCtx->pDec->iLinesize, - pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture); + pCtx->pDec->iLinesize, + pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture); } pCtx->pDec = NULL; //after frame decoding, always set to NULL }