bug fix for parseonly multi-data in

This commit is contained in:
huili2 2015-04-07 02:18:13 -07:00
parent 050c683a27
commit 20f28cd2f2
3 changed files with 6 additions and 4 deletions

View File

@ -367,6 +367,7 @@ typedef struct TagWelsDecoderContext {
//for Parse only //for Parse only
bool bParseOnly; bool bParseOnly;
bool bFramePending; bool bFramePending;
bool bFrameFinish;
int32_t iNalNum; int32_t iNalNum;
int32_t iNalLenInByte[MAX_NAL_UNITS_IN_LAYER]; int32_t iNalLenInByte[MAX_NAL_UNITS_IN_LAYER];
SSpsBsInfo sSpsBsInfo [MAX_SPS_COUNT]; SSpsBsInfo sSpsBsInfo [MAX_SPS_COUNT];

View File

@ -487,6 +487,7 @@ int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) {
pCtx->bNewSeqBegin = true; pCtx->bNewSeqBegin = true;
pCtx->bPrintFrameErrorTraceFlag = true; pCtx->bPrintFrameErrorTraceFlag = true;
pCtx->iIgnoredErrorInfoPacketCount = 0; pCtx->iIgnoredErrorInfoPacketCount = 0;
pCtx->bFrameFinish = true;
return iRet; return iRet;
} }

View File

@ -74,7 +74,6 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
if (pCtx->bParseOnly) { //should exit for parse only to prevent access NULL pDstInfo if (pCtx->bParseOnly) { //should exit for parse only to prevent access NULL pDstInfo
PAccessUnit pCurAu = pCtx->pAccessUnitList; PAccessUnit pCurAu = pCtx->pAccessUnitList;
static bool bFirstIDR = true;
if (dsErrorFree == pCtx->iErrorCode) { //correct decoding, add to data buffer if (dsErrorFree == pCtx->iErrorCode) { //correct decoding, add to data buffer
SParserBsInfo* pParser = pCtx->pParserBsInfo; SParserBsInfo* pParser = pCtx->pParserBsInfo;
SNalUnit* pCurNal = NULL; SNalUnit* pCurNal = NULL;
@ -94,7 +93,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
pParser->iSpsHeightInPixel = (pCtx->pSps->iMbHeight << 4); pParser->iSpsHeightInPixel = (pCtx->pSps->iMbHeight << 4);
if (pCurAu->pNalUnitsList [iIdx]->sNalHeaderExt.bIdrFlag) { //IDR if (pCurAu->pNalUnitsList [iIdx]->sNalHeaderExt.bIdrFlag) { //IDR
if (bFirstIDR) { //add required sps/pps if (pCtx->bFrameFinish) { //add required sps/pps
bool bSubSps = (NAL_UNIT_CODED_SLICE_EXT == pCurAu->pNalUnitsList [iIdx]->sNalHeaderExt.sNalUnitHeader.eNalUnitType); bool bSubSps = (NAL_UNIT_CODED_SLICE_EXT == pCurAu->pNalUnitsList [iIdx]->sNalHeaderExt.sNalUnitHeader.eNalUnitType);
SSpsBsInfo* pSpsBs = NULL; SSpsBsInfo* pSpsBs = NULL;
SPpsBsInfo* pPpsBs = NULL; SPpsBsInfo* pPpsBs = NULL;
@ -111,10 +110,10 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
memcpy (pDstBuf, pPpsBs->pPpsBsBuf, pPpsBs->uiPpsBsLen); memcpy (pDstBuf, pPpsBs->pPpsBsBuf, pPpsBs->uiPpsBsLen);
pParser->iNalLenInByte [pParser->iNalNum ++] = pPpsBs->uiPpsBsLen; pParser->iNalLenInByte [pParser->iNalNum ++] = pPpsBs->uiPpsBsLen;
pDstBuf += pPpsBs->uiPpsBsLen; pDstBuf += pPpsBs->uiPpsBsLen;
bFirstIDR = false; pCtx->bFrameFinish = false;
} }
} else { //IDR required SPS, PPS } else { //IDR required SPS, PPS
bFirstIDR = true; pCtx->bFrameFinish = true;
} }
//then VCL data re-write //then VCL data re-write
while (iIdx <= iEndIdx) { while (iIdx <= iEndIdx) {
@ -2364,6 +2363,7 @@ bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferIn
} }
} else if (pCtx->bParseOnly) { //clear parse only internal data status } else if (pCtx->bParseOnly) { //clear parse only internal data status
pCtx->pParserBsInfo->iNalNum = 0; pCtx->pParserBsInfo->iNalNum = 0;
pCtx->bFrameFinish = true; //clear frame pending status here!
} else { } else {
if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo)) { if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo)) {
pCtx->pDec = NULL; pCtx->pDec = NULL;