History

output error when frame incomplete for parse only usage

huili2 committed 11 years ago

Commit b719c3b1 parent d2d4ab82 files · +23 −13Browse files

Showing the changes to codec/decoder/core/src/decoder_core.cpp (1 of 2 files). Show all

Unified · Split

codec/decoder/core/src/decoder_core.cpp+13−8
@@ -45,6 +45,8 @@ · 44 unmodified lines
4545
4646 namespace WelsDec {
4747 static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {
48+ if (pDstInfo == NULL) //parse only usage
49+ return -1;
4850 PDqLayer pCurDq = pCtx->pCurDqLayer;
4951 PPicture pPic = pCtx->pDec;
5052
@@ -1760,7 +1762,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 1709 unmodified lines
17601762 iErr = DecodeCurrentAccessUnit (pCtx, ppDst, pDstInfo);
17611763
17621764 if (pCtx->bParseOnly) {
1763− if (dsErrorFree == pCtx->iErrorCode) {
1765+ if ((dsErrorFree == pCtx->iErrorCode) && (pCtx->iTotalNumMbRec == pCtx->pSps->iMbHeight * pCtx->pSps->iMbWidth)) {
17641766 SParserBsInfo* pParser = pCtx->pParserBsInfo;
17651767 uint8_t* pDstBuf = pParser->pDstBuff;
17661768 SNalUnit* pCurNal = NULL;
@@ -1804,6 +1806,10 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 37 unmodified lines
18041806 pCtx->pParserBsInfo->iNalNum = 0;
18051807 pCtx->pParserBsInfo->iSpsWidthInPixel = 0;
18061808 pCtx->pParserBsInfo->iSpsHeightInPixel = 0;
1809+ if (dsErrorFree == pCtx->iErrorCode) { //frame not complete
1810+ pCtx->iTotalNumMbRec = 0;
1811+ pCtx->iErrorCode |= dsFramePending;
1812+ }
18071813 }
18081814 }
18091815
@@ -2082,12 +2088,10 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 272 unmodified lines
20822088 }
20832089 }
20842090
2085− if (!pCtx->bParseOnly) {
2086− if (bReconstructSlice) {
2087− if (WelsDecodeConstructSlice (pCtx, pNalCur)) {
2088− pCtx->pDec->bIsComplete = false; // reconstruction error, directly set the flag false
2089− return -1;
2090− }
2091+ if (bReconstructSlice) {
2092+ if (WelsDecodeConstructSlice (pCtx, pNalCur)) {
2093+ pCtx->pDec->bIsComplete = false; // reconstruction error, directly set the flag false
2094+ return -1;
20912095 }
20922096 }
20932097 if (bAllRefComplete && pCtx->eSliceType != I_SLICE) {
@@ -2158,7 +2162,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 64 unmodified lines
21582162 return iRet;
21592163 }
21602164 }
2161− ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel,
2165+ if (!pCtx->bParseOnly)
2166+ ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel,
21622167 pCtx->pDec->iLinesize,
21632168 pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture);
21642169 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t