shithub: openh264

Download patch

ref: 881667a5335df2450eed78315b3a7b1fd5bebd6d
parent: d63172db9bc8c698c618cb35451a2b97f2b1faca
author: lyao2 <[email protected]>
date: Fri Sep 5 09:28:13 EDT 2014

fix pps caused death loop issue

--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -2680,7 +2680,6 @@
   //31st finish:	next_spsid_in_bs == 1;
 
   const int32_t kiEncId			= kiCurEncoderParaSetId;
-  const bool* kpUsedIdPointer   = &sParaSetOffsetVariable->bUsedParaSetIdInBs[0];
   uint32_t uiNextIdInBs			= sParaSetOffsetVariable->uiNextParaSetIdToUseInBs;
 
   //update current layer's pCodingParam
@@ -2691,20 +2690,12 @@
 
   //prepare for next update:
   //   find the next avaibable iId
-  do {
-    ++uiNextIdInBs;
-    if (uiNextIdInBs >= kuiMaxIdInBs) {
-      uiNextIdInBs = 0;//ensure the SPS_ID wound not exceed MAX_SPS_COUNT
-    }
-  } while (kpUsedIdPointer[uiNextIdInBs]);
-
+  ++uiNextIdInBs;
+  if (uiNextIdInBs >= kuiMaxIdInBs) {
+    uiNextIdInBs = 0;//ensure the SPS_ID wound not exceed MAX_SPS_COUNT
+  }
   //   update next_id
   sParaSetOffsetVariable->uiNextParaSetIdToUseInBs = uiNextIdInBs;
-
-#if _DEBUG
-  assert (!sParaSetOffsetVariable->bUsedParaSetIdInBs[uiNextIdInBs]);   //sure the next-to-use one is marked activated correctly
-#endif
-
 }
 
 /*!