shithub: openh264

Download patch

ref: cf3845779f0e6a8b7806d40d62443514e36c63c1
parent: 78ab4000c086c07d6841365541fd86d12ca98e4d
author: huili2 <huili2@cisco.com>
date: Fri Apr 10 08:23:43 EDT 2015

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;