shithub: openh264

Download patch

ref: e48585236e0fed62f35d3715d4aedf133a0a8a62
parent: d92853c88ef42545b9d7f8342f41ebe4cda22610
author: huili2 <huili2@cisco.com>
date: Wed Jan 7 17:34:55 EST 2015

prevent error propagation for parse only when frame is not complete

--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -1762,7 +1762,8 @@
   iErr = DecodeCurrentAccessUnit (pCtx, ppDst, pDstInfo);
 
   if (pCtx->bParseOnly) {
-    if ((dsErrorFree == pCtx->iErrorCode) && ((uint32_t) pCtx->iTotalNumMbRec == pCtx->pSps->iMbHeight * pCtx->pSps->iMbWidth)) {
+    if ((dsErrorFree == pCtx->iErrorCode)
+        && ((uint32_t) pCtx->iTotalNumMbRec == pCtx->pSps->iMbHeight * pCtx->pSps->iMbWidth)) {
       SParserBsInfo* pParser = pCtx->pParserBsInfo;
       uint8_t* pDstBuf = pParser->pDstBuff;
       SNalUnit* pCurNal = NULL;
@@ -2128,6 +2129,10 @@
     pCtx->pDec->bIsComplete = bAllRefComplete;
     if (!pCtx->pDec->bIsComplete) {  // Ref pictures ECed, result in ECed
       pCtx->iErrorCode |= dsDataErrorConcealed;
+    } else if (pCtx->bParseOnly) {
+      pCtx->pDec->bIsComplete = (pCtx->iTotalNumMbRec == pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight);
+      if (!pCtx->pDec->bIsComplete)
+        return -1;
     }
 
     // A dq layer decoded here
@@ -2165,8 +2170,8 @@
         }
         if (!pCtx->bParseOnly)
           ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel,
-                                  pCtx->pDec->iLinesize,
-                                  pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture);
+                                    pCtx->pDec->iLinesize,
+                                    pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture);
       }
       pCtx->pDec = NULL; //after frame decoding, always set to NULL
     }