shithub: openh264

Download patch

ref: c87672974d41b43454395f07f3d229b9a5c78ad7
parent: be9c467974ec8368a3885aad1b83f60858b0e8f6
parent: 18c3c096c62b7fef244330da57401ec365de5a1b
author: sijchen <sijchen@cisco.com>
date: Thu Feb 7 03:30:02 EST 2019

Merge pull request #3093 from xiaotiansf/NewBugzilla

Fix Bugzilla reported bug-1525097.

--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -2652,7 +2652,7 @@
                 pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int8_t) * MB_BLOCK4x4_NUM);
         for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
           uint32_t i = 0;
-          while (pCtx->sRefPic.pRefList[listIdx][i]) {
+          while (pCtx->sRefPic.pRefList[listIdx][i] && i < MAX_DPB_COUNT) {
             pCtx->pDec->pRefPic[listIdx][i] = pCtx->sRefPic.pRefList[listIdx][i];
             ++i;
           }
--- a/codec/decoder/core/src/manage_dec_ref.cpp
+++ b/codec/decoder/core/src/manage_dec_ref.cpp
@@ -79,6 +79,10 @@
     pRef->uiSpatialId = -1;
     pRef->iSpsId = -1;
     pRef->bIsComplete = false;
+    for (int32_t i = 0; i < MAX_DPB_COUNT; ++i) {
+      pRef->pRefPic[LIST_0][i] = NULL;
+      pRef->pRefPic[LIST_1][i] = NULL;
+    }
   }
 }
 
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -581,10 +581,16 @@
 
     eNalType = m_pDecContext->sCurNalHead.eNalUnitType;
 
+    if ((m_pDecContext->iErrorCode & dsRefLost) && m_pDecContext->eSliceType == B_SLICE) {
+      if (ResetDecoder()) {
+        return dsRefLost;
+      }
+      return dsErrorFree;
+    }
     if (m_pDecContext->iErrorCode & dsOutOfMemory) {
-      if (ResetDecoder())
+      if (ResetDecoder()) {
         return dsOutOfMemory;
-
+      }
       return dsErrorFree;
     }
     //for AVC bitstream (excluding AVC with temporal scalability, including TP), as long as error occur, SHOULD notify upper layer key frame loss.