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