shithub: openh264

Download patch

ref: 3a91abf28c08aa7572d96e37e08b1e951ae2ce8c
parent: d92853c88ef42545b9d7f8342f41ebe4cda22610
parent: e48585236e0fed62f35d3715d4aedf133a0a8a62
author: HaiboZhu <haibozhu@cisco.com>
date: Thu Jan 8 11:09:02 EST 2015

Merge pull request #1710 from huili2/parseonly_framecomplete_error_prop

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
     }