shithub: openh264

Download patch

ref: 1cf8b7ada9e2ac9506d6e8d953f1d389a05b1d2e
parent: da8dd9d9b32b42472cd8ca8f81c301482d24d73b
parent: cdcb538c12168cc11d4fe2da65b3c5732498d3d6
author: huili2 <[email protected]>
date: Tue Jan 29 05:09:31 EST 2019

Merge pull request #3090 from xiaotiansf/NewBugzilla

Fix new Bugzilla reported bug-1522172

--- a/codec/decoder/plus/inc/welsDecoderExt.h
+++ b/codec/decoder/plus/inc/welsDecoderExt.h
@@ -131,6 +131,7 @@
   int32_t InitDecoder (const SDecodingParam* pParam);
   void UninitDecoder (void);
   int32_t ResetDecoder();
+  void ResetReorderingPictureBuffers();
 
   void OutputStatisticsLog (SDecoderStatistics& sDecoderStatistics);
   DECODING_STATE ReorderPicturesInDisplay (unsigned char** ppDst, SBufferInfo* pDstInfo);
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -295,6 +295,9 @@
   } else if (m_pWelsTrace != NULL) {
     WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "ResetDecoder() failed as decoder context null");
   }
+#ifdef _PICTURE_REORDERING_
+  ResetReorderingPictureBuffers();
+#endif
   return ERR_INFO_UNINIT;
 }
 
@@ -971,6 +974,18 @@
   return state;
 }
 
+void CWelsDecoder::ResetReorderingPictureBuffers() {
+  m_iPictInfoIndex = 0;
+  m_iMinPOC = sIMinInt32;
+  m_iNumOfPicts = 0;
+  m_iLastGOPRemainPicts = 0;
+  m_LastWrittenPOC = sIMinInt32;
+  m_iLargestBufferedPicIndex = 0;
+  for (int32_t i = 0; i < 16; ++i) {
+    m_sPictInfoList[i].bLastGOP = false;
+    m_sPictInfoList[i].iPOC = sIMinInt32;
+  }
+}
 
 } // namespace WelsDec