shithub: openh264

Download patch

ref: 46d1c93016ff2b2faa9f0f716acb1e6770adb69b
parent: 2f0b6c8f14acbe6c9f60a5867f6fbd52734c3063
parent: cf3845779f0e6a8b7806d40d62443514e36c63c1
author: HaiboZhu <[email protected]>
date: Mon Apr 13 06:24:28 EDT 2015

Merge pull request #1892 from huili2/bugfix_greenissue_parseonly

bugfix for HW decoding green issue

--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -112,8 +112,6 @@
           pDstBuf += pPpsBs->uiPpsBsLen;
           pCtx->bFrameFinish = false;
         }
-      } else { //IDR required SPS, PPS
-        pCtx->bFrameFinish = true;
       }
       //then VCL data re-write
       while (iIdx <= iEndIdx) {
@@ -127,9 +125,11 @@
       if (pCtx->iTotalNumMbRec == kiTotalNumMbInCurLayer) { //frame complete
         pCtx->iTotalNumMbRec = 0;
         pCtx->bFramePending = false;
+        pCtx->bFrameFinish = true; //finish current frame and mark it
       } else if (pCtx->iTotalNumMbRec != 0) { //frame incomplete
         pCtx->bFramePending = true;
         pCtx->pDec->bIsComplete = false;
+        pCtx->bFrameFinish = false; //current frame not finished
         pCtx->iErrorCode |= dsFramePending;
         return -1;
         //pCtx->pParserBsInfo->iNalNum = 0;
@@ -2099,6 +2099,8 @@
         pCtx->iErrorCode |= dsOutOfMemory;
         return ERR_INFO_REF_COUNT_OVERFLOW;
       }
+      pCtx->pDec->bNewSeqBegin = pCtx->bNewSeqBegin; //set flag for start decoding
+    } else if (pCtx->iTotalNumMbRec == 0) { //pDec != NULL, already start
       pCtx->pDec->bNewSeqBegin = pCtx->bNewSeqBegin; //set flag for start decoding
     }
     pCtx->pDec->uiTimeStamp = pNalCur->uiTimeStamp;