Showing the changes to codec/decoder/core/src/decoder_core.cpp (1 of 3 files). Show all
Unified · Split
| @@ -74,7 +74,6 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 73 unmodified lines | ||
| 74 | 74 | |
| 75 | 75 | if (pCtx->bParseOnly) { //should exit for parse only to prevent access NULL pDstInfo |
| 76 | 76 | PAccessUnit pCurAu = pCtx->pAccessUnitList; |
| 77 | − static bool bFirstIDR = true; | |
| 78 | 77 | if (dsErrorFree == pCtx->iErrorCode) { //correct decoding, add to data buffer |
| 79 | 78 | SParserBsInfo* pParser = pCtx->pParserBsInfo; |
| 80 | 79 | SNalUnit* pCurNal = NULL; |
| @@ -94,7 +93,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 13 unmodified lines | ||
| 94 | 93 | pParser->iSpsHeightInPixel = (pCtx->pSps->iMbHeight << 4); |
| 95 | 94 | |
| 96 | 95 | if (pCurAu->pNalUnitsList [iIdx]->sNalHeaderExt.bIdrFlag) { //IDR |
| 97 | − if (bFirstIDR) { //add required sps/pps | |
| 96 | + if (pCtx->bFrameFinish) { //add required sps/pps | |
| 98 | 97 | bool bSubSps = (NAL_UNIT_CODED_SLICE_EXT == pCurAu->pNalUnitsList [iIdx]->sNalHeaderExt.sNalUnitHeader.eNalUnitType); |
| 99 | 98 | SSpsBsInfo* pSpsBs = NULL; |
| 100 | 99 | SPpsBsInfo* pPpsBs = NULL; |
| @@ -111,10 +110,10 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 10 unmodified lines | ||
| 111 | 110 | memcpy (pDstBuf, pPpsBs->pPpsBsBuf, pPpsBs->uiPpsBsLen); |
| 112 | 111 | pParser->iNalLenInByte [pParser->iNalNum ++] = pPpsBs->uiPpsBsLen; |
| 113 | 112 | pDstBuf += pPpsBs->uiPpsBsLen; |
| 114 | − bFirstIDR = false; | |
| 113 | + pCtx->bFrameFinish = false; | |
| 115 | 114 | } |
| 116 | 115 | } else { //IDR required SPS, PPS |
| 117 | − bFirstIDR = true; | |
| 116 | + pCtx->bFrameFinish = true; | |
| 118 | 117 | } |
| 119 | 118 | //then VCL data re-write |
| 120 | 119 | while (iIdx <= iEndIdx) { |
| @@ -2364,6 +2363,7 @@ bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferIn · 2243 unmodified lines | ||
| 2364 | 2363 | } |
| 2365 | 2364 | } else if (pCtx->bParseOnly) { //clear parse only internal data status |
| 2366 | 2365 | pCtx->pParserBsInfo->iNalNum = 0; |
| 2366 | + pCtx->bFrameFinish = true; //clear frame pending status here! | |
| 2367 | 2367 | } else { |
| 2368 | 2368 | if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo)) { |
| 2369 | 2369 | pCtx->pDec = NULL; |