ref: c20e1c6795b4159bfa17fca1fc5735b08dfa9256
parent: 93265d7a446f339e6e9e37e25d428131ca82c5f3
author: huili2 <huili2@cisco.com>
date: Sun Dec 14 13:36:27 EST 2014
change au_ready status and check au number
--- a/codec/decoder/core/src/au_parser.cpp
+++ b/codec/decoder/core/src/au_parser.cpp
@@ -271,7 +271,9 @@
if (uiAvailNalNum > 1) {
pCurAu->uiEndPos = uiAvailNalNum - 2;
- pCtx->bAuReadyFlag = true;
+ if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
+ pCtx->bAuReadyFlag = true;
+ }
}
pCtx->iErrorCode |= dsBitstreamError;
return NULL;
@@ -291,7 +293,9 @@
if (uiAvailNalNum > 1) {
pCurAu->uiEndPos = uiAvailNalNum - 2;
- pCtx->bAuReadyFlag = true;
+ if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
+ pCtx->bAuReadyFlag = true;
+ }
}
pCtx->iErrorCode |= dsBitstreamError;
return NULL;
@@ -340,7 +344,9 @@
ForceClearCurrentNal (pCurAu);
if (uiAvailNalNum > 1) {
pCurAu->uiEndPos = uiAvailNalNum - 2;
- pCtx->bAuReadyFlag = true;
+ if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
+ pCtx->bAuReadyFlag = true;
+ }
}
WelsLog (pLogCtx, WELS_LOG_ERROR, "NAL_UNIT_CODED_SLICE: InitBits() fail due invalid access.");
pCtx->iErrorCode |= dsBitstreamError;
@@ -357,7 +363,9 @@
if (uiAvailNalNum > 1) {
pCurAu->uiEndPos = uiAvailNalNum - 2;
- pCtx->bAuReadyFlag = true;
+ if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
+ pCtx->bAuReadyFlag = true;
+ }
}
pCtx->iErrorCode |= dsBitstreamError;
return NULL;
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -626,23 +626,25 @@
pDstNal[iDstIdx] = pDstNal[iDstIdx + 1] = pDstNal[iDstIdx + 2] = pDstNal[iDstIdx + 3] =
0; // set 4 reserved bytes to zero
pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes);
- if (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1)) {
- CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo);
- }
- if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) {
- iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes, pSrcNal - 3, iSrcIdx + 3);
- }
- if (pCtx->bAuReadyFlag) {
- ConstructAccessUnit (pCtx, ppDst, pDstBufInfo);
+ if (pNalPayload) { //parse correct
+ if (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1)) {
+ CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo);
+ }
+ if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType)) {
+ iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes, pSrcNal - 3, iSrcIdx + 3);
+ }
+ if (pCtx->bAuReadyFlag) {
+ ConstructAccessUnit (pCtx, ppDst, pDstBufInfo);
- if ((dsOutOfMemory | dsNoParamSets) & pCtx->iErrorCode) {
+ if ((dsOutOfMemory | dsNoParamSets) & pCtx->iErrorCode) {
#ifdef LONG_TERM_REF
- pCtx->bParamSetsLostFlag = true;
+ pCtx->bParamSetsLostFlag = true;
#else
- pCtx->bReferenceLostAtT0Flag = true;
+ pCtx->bReferenceLostAtT0Flag = true;
#endif
- if (dsOutOfMemory & pCtx->iErrorCode) {
- return pCtx->iErrorCode;
+ if (dsOutOfMemory & pCtx->iErrorCode) {
+ return pCtx->iErrorCode;
+ }
}
}
}
@@ -682,22 +684,24 @@
pDstNal[iDstIdx] = pDstNal[iDstIdx + 1] = pDstNal[iDstIdx + 2] = pDstNal[iDstIdx + 3] =
0; // set 4 reserved bytes to zero
pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes);
- if (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1)) {
- CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo);
- }
- if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) {
- iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes, pSrcNal - 3, iSrcIdx + 3);
- }
- if (pCtx->bAuReadyFlag) {
- ConstructAccessUnit (pCtx, ppDst, pDstBufInfo);
+ if (pNalPayload) { //parse correct
+ if (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1)) {
+ CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo);
+ }
+ if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType)) {
+ iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes, pSrcNal - 3, iSrcIdx + 3);
+ }
+ if (pCtx->bAuReadyFlag) {
+ ConstructAccessUnit (pCtx, ppDst, pDstBufInfo);
- if ((dsOutOfMemory | dsNoParamSets) & pCtx->iErrorCode) {
+ if ((dsOutOfMemory | dsNoParamSets) & pCtx->iErrorCode) {
#ifdef LONG_TERM_REF
- pCtx->bParamSetsLostFlag = true;
+ pCtx->bParamSetsLostFlag = true;
#else
- pCtx->bReferenceLostAtT0Flag = true;
+ pCtx->bReferenceLostAtT0Flag = true;
#endif
- return pCtx->iErrorCode;
+ return pCtx->iErrorCode;
+ }
}
}
if (iRet) {
--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -2140,6 +2140,8 @@
bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {
PAccessUnit pAu = pCtx->pAccessUnitList;
+ if (pAu->uiAvailUnitsNum == 0)
+ return true;
PNalUnit pCurNal = pAu->pNalUnitsList[pAu->uiEndPos];
if ((pCtx->iTotalNumMbRec != 0)
&& (CheckAccessUnitBoundaryExt (&pCtx->sLastNalHdrExt, &pCurNal->sNalHeaderExt, &pCtx->sLastSliceHeader,