Merge pull request #1890 from huili2/parseonly_bugfix_for_multi_in

bug fix for parseonly multi-data in
This commit is contained in:
HaiboZhu 2015-04-08 10:29:54 +08:00
commit 78ab4000c0
3 changed files with 6 additions and 4 deletions

View File

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

View File

@ -487,6 +487,7 @@ int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) {
pCtx->bNewSeqBegin = true;
pCtx->bPrintFrameErrorTraceFlag = true;
pCtx->iIgnoredErrorInfoPacketCount = 0;
pCtx->bFrameFinish = true;
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
PAccessUnit pCurAu = pCtx->pAccessUnitList;
static bool bFirstIDR = true;
if (dsErrorFree == pCtx->iErrorCode) { //correct decoding, add to data buffer
SParserBsInfo* pParser = pCtx->pParserBsInfo;
SNalUnit* pCurNal = NULL;
@ -94,7 +93,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
pParser->iSpsHeightInPixel = (pCtx->pSps->iMbHeight << 4);
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);
SSpsBsInfo* pSpsBs = NULL;
SPpsBsInfo* pPpsBs = NULL;
@ -111,10 +110,10 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
memcpy (pDstBuf, pPpsBs->pPpsBsBuf, pPpsBs->uiPpsBsLen);
pParser->iNalLenInByte [pParser->iNalNum ++] = pPpsBs->uiPpsBsLen;
pDstBuf += pPpsBs->uiPpsBsLen;
bFirstIDR = false;
pCtx->bFrameFinish = false;
}
} else { //IDR required SPS, PPS
bFirstIDR = true;
pCtx->bFrameFinish = true;
}
//then VCL data re-write
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
pCtx->pParserBsInfo->iNalNum = 0;
pCtx->bFrameFinish = true; //clear frame pending status here!
} else {
if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo)) {
pCtx->pDec = NULL;