Merge pull request #1139 from huili2/parse_fail_master
add return info for all cases
This commit is contained in:
commit
6310017877
@ -131,6 +131,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
|
|||||||
|
|
||||||
pNalUnitHeader->uiForbiddenZeroBit = (uint8_t) (pNal[0] >> 7); // uiForbiddenZeroBit
|
pNalUnitHeader->uiForbiddenZeroBit = (uint8_t) (pNal[0] >> 7); // uiForbiddenZeroBit
|
||||||
if (pNalUnitHeader->uiForbiddenZeroBit) { //2010.4.14
|
if (pNalUnitHeader->uiForbiddenZeroBit) { //2010.4.14
|
||||||
|
pCtx->iErrorCode |= dsBitstreamError;
|
||||||
return NULL; //uiForbiddenZeroBit should always equal to 0
|
return NULL; //uiForbiddenZeroBit should always equal to 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,8 +187,6 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
|
|||||||
pCurNal = &pCtx->sPrefixNal;
|
pCurNal = &pCtx->sPrefixNal;
|
||||||
|
|
||||||
if (iNalSize < NAL_UNIT_HEADER_EXT_SIZE) {
|
if (iNalSize < NAL_UNIT_HEADER_EXT_SIZE) {
|
||||||
pCtx->iErrorCode |= dsBitstreamError;
|
|
||||||
|
|
||||||
PAccessUnit pCurAu = pCtx->pAccessUnitList;
|
PAccessUnit pCurAu = pCtx->pAccessUnitList;
|
||||||
uint32_t uiAvailNalNum = pCurAu->uiAvailUnitsNum;
|
uint32_t uiAvailNalNum = pCurAu->uiAvailUnitsNum;
|
||||||
|
|
||||||
@ -198,6 +197,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
pCurNal->sNalData.sPrefixNal.bPrefixNalCorrectFlag = false;
|
pCurNal->sNalData.sPrefixNal.bPrefixNalCorrectFlag = false;
|
||||||
|
pCtx->iErrorCode |= dsBitstreamError;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
pCurNal->sNalData.sPrefixNal.bPrefixNalCorrectFlag = false;
|
pCurNal->sNalData.sPrefixNal.bPrefixNalCorrectFlag = false;
|
||||||
pCtx->iErrorCode |= dsInvalidArgument;
|
pCtx->iErrorCode |= dsBitstreamError;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,14 +260,13 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
|
|||||||
|
|
||||||
if (pNalUnitHeader->eNalUnitType == NAL_UNIT_CODED_SLICE_EXT) {
|
if (pNalUnitHeader->eNalUnitType == NAL_UNIT_CODED_SLICE_EXT) {
|
||||||
if (iNalSize < NAL_UNIT_HEADER_EXT_SIZE) {
|
if (iNalSize < NAL_UNIT_HEADER_EXT_SIZE) {
|
||||||
pCtx->iErrorCode |= dsBitstreamError;
|
|
||||||
|
|
||||||
ForceClearCurrentNal (pCurAu);
|
ForceClearCurrentNal (pCurAu);
|
||||||
|
|
||||||
if (uiAvailNalNum > 1) {
|
if (uiAvailNalNum > 1) {
|
||||||
pCurAu->uiEndPos = uiAvailNalNum - 2;
|
pCurAu->uiEndPos = uiAvailNalNum - 2;
|
||||||
pCtx->bAuReadyFlag = true;
|
pCtx->bAuReadyFlag = true;
|
||||||
}
|
}
|
||||||
|
pCtx->iErrorCode |= dsBitstreamError;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,13 +280,13 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
|
|||||||
WelsLog (pLogCtx, WELS_LOG_WARNING, "ParseNalHeader():bUseRefBasePicFlag (%d) != 0, MGS not supported!\n",
|
WelsLog (pLogCtx, WELS_LOG_WARNING, "ParseNalHeader():bUseRefBasePicFlag (%d) != 0, MGS not supported!\n",
|
||||||
pCurNal->sNalHeaderExt.bUseRefBasePicFlag);
|
pCurNal->sNalHeaderExt.bUseRefBasePicFlag);
|
||||||
|
|
||||||
pCtx->iErrorCode |= dsInvalidArgument;
|
|
||||||
ForceClearCurrentNal (pCurAu);
|
ForceClearCurrentNal (pCurAu);
|
||||||
|
|
||||||
if (uiAvailNalNum > 1) {
|
if (uiAvailNalNum > 1) {
|
||||||
pCurAu->uiEndPos = uiAvailNalNum - 2;
|
pCurAu->uiEndPos = uiAvailNalNum - 2;
|
||||||
pCtx->bAuReadyFlag = true;
|
pCtx->bAuReadyFlag = true;
|
||||||
}
|
}
|
||||||
|
pCtx->iErrorCode |= dsBitstreamError;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pNal += NAL_UNIT_HEADER_EXT_SIZE;
|
pNal += NAL_UNIT_HEADER_EXT_SIZE;
|
||||||
@ -321,6 +320,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
|
|||||||
pCurAu->uiEndPos = uiAvailNalNum - 2;
|
pCurAu->uiEndPos = uiAvailNalNum - 2;
|
||||||
pCtx->bAuReadyFlag = true;
|
pCtx->bAuReadyFlag = true;
|
||||||
}
|
}
|
||||||
|
pCtx->iErrorCode |= dsBitstreamError;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,6 +433,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
|
|||||||
|
|
||||||
if (NULL == DetectStartCodePrefix (kpBsBuf, &iOffset,
|
if (NULL == DetectStartCodePrefix (kpBsBuf, &iOffset,
|
||||||
kiBsLen)) { //CAN'T find the 00 00 01 start prefix from the source buffer
|
kiBsLen)) { //CAN'T find the 00 00 01 start prefix from the source buffer
|
||||||
|
pCtx->iErrorCode |= dsBitstreamError;
|
||||||
return dsBitstreamError;
|
return dsBitstreamError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user