shithub: openh264

Download patch

ref: cdcb538c12168cc11d4fe2da65b3c5732498d3d6
parent: da8dd9d9b32b42472cd8ca8f81c301482d24d73b
author: xiaotiansf <xiaotianshimail@gmail.com>
date: Sat Jan 26 11:40:37 EST 2019

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