shithub: openh264

Download patch

ref: 3a73179cab23db7207489095f86c8d79b06c8c2e
parent: 69f6db1b90cbf8d83fc490b5412a9f494c2edc20
parent: aa5e7f7927a3c023fb34d2a268b0b3b86f1d1421
author: zhilwang <zhilwang@cisco.com>
date: Thu Nov 27 09:21:48 EST 2014

Merge pull request #1559 from HaiboZhu/EC_off_crash_no_output

Debug for (1) decoder crash when delay decoding (2) no output when EC off

--- a/codec/decoder/core/inc/decoder.h
+++ b/codec/decoder/core/inc/decoder.h
@@ -132,8 +132,6 @@
 
 void AssignFuncPointerForRec (PWelsDecoderContext pCtx);
 
-void ResetParameterSetsState (PWelsDecoderContext pCtx);
-
 void GetVclNalTemporalId (PWelsDecoderContext pCtx); //get the info that whether or not have VCL NAL in current AU,
 //and if YES, get the temporal ID
 
--- a/codec/decoder/core/src/au_parser.cpp
+++ b/codec/decoder/core/src/au_parser.cpp
@@ -791,6 +791,14 @@
     if (pCtx->pActiveLayerSps[i] == pSps)
       return true;
   }
+  // Pre-active, will be used soon
+  if (pSps->iMbWidth > 0  && pSps->iMbHeight > 0 && pCtx->bSpsAvailFlags[pSps->iSpsId]
+      && pCtx->pAccessUnitList->uiAvailUnitsNum > 0) {
+    PSps pNextUsedSps =
+      pCtx->pAccessUnitList->pNalUnitsList[pCtx->pAccessUnitList->uiStartPos]->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps;
+    if (pNextUsedSps->iSpsId == pSps->iSpsId)
+      return true;
+  }
   return false;
 }
 
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -502,9 +502,6 @@
 #else
               pCtx->bReferenceLostAtT0Flag = true;
 #endif
-              if ((pCtx->eErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode))
-                ResetParameterSetsState (pCtx);
-
               if (dsOutOfMemory & pCtx->iErrorCode) {
                 return pCtx->iErrorCode;
               }
@@ -518,8 +515,6 @@
 #else
               pCtx->bReferenceLostAtT0Flag = true;
 #endif
-              if ((pCtx->eErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode))
-                ResetParameterSetsState (pCtx);
             }
             return pCtx->iErrorCode;
           }
@@ -563,8 +558,6 @@
 #else
         pCtx->bReferenceLostAtT0Flag = true;
 #endif
-        if ((pCtx->eErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode))
-          ResetParameterSetsState (pCtx);
         return pCtx->iErrorCode;
       }
     }
@@ -576,7 +569,6 @@
 #else
         pCtx->bReferenceLostAtT0Flag = true;
 #endif
-        ResetParameterSetsState (pCtx);
       }
       return pCtx->iErrorCode;
     }
@@ -598,8 +590,6 @@
 #else
         pCtx->bReferenceLostAtT0Flag = true;
 #endif
-        if ((pCtx->eErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode))
-          ResetParameterSetsState (pCtx);
         return pCtx->iErrorCode;
       }
     }
--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -156,13 +156,6 @@
   if (0 == pCurNal->sNalHeaderExt.uiTemporalId) {
     pCtx->bReferenceLostAtT0Flag = true;
   }
-  if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
-#ifndef LONG_TERM_REF
-    if (pCtx->bReferenceLostAtT0Flag) {
-      ResetParameterSetsState (pCtx);
-    }
-#endif
-  }
   pCtx->iErrorCode |= dsBitstreamError;
 }
 
@@ -170,13 +163,6 @@
   if ((0 == pCurNal->sNalHeaderExt.uiTemporalId) || (1 == pCurNal->sNalHeaderExt.uiTemporalId)) {
     pCtx->bReferenceLostAtT0Flag = true;
   }
-  if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
-#ifndef LONG_TERM_REF
-    if (pCtx->bReferenceLostAtT0Flag) {
-      ResetParameterSetsState (pCtx);
-    }
-#endif
-  }
   pCtx->iErrorCode |= dsRefLost;
 }
 
@@ -1883,14 +1869,6 @@
   }
 }
 
-// added to reset state of parameter sets to waiting successive incoming IDR, 6/4/2010
-// It will be called in case packets lost/ broken and decoded failed at temporal level 0
-void ResetParameterSetsState (PWelsDecoderContext pCtx) {
-  pCtx->bSpsExistAheadFlag	   = false;
-  pCtx->bSubspsExistAheadFlag = false;
-  pCtx->bPpsExistAheadFlag	   = false;
-}
-
 /*
  * DecodeCurrentAccessUnit
  * Decode current access unit when current AU is completed.
@@ -2028,7 +2006,6 @@
 #else
               pCtx->bReferenceLostAtT0Flag = true;
 #endif
-              ResetParameterSetsState (pCtx);
               return ERR_INFO_REFERENCE_PIC_LOST;
             }
           }
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -447,7 +447,6 @@
 #else
         m_pDecContext->bReferenceLostAtT0Flag = true;
 #endif
-        ResetParameterSetsState (m_pDecContext);  //initial SPS&PPS ready flag
       }
     }