shithub: openh264

Download patch

ref: 3be7e9022185816ef384343fcc06126e92afd350
parent: 48e79d51b593271b8fd8dbd273aab2fc6b0b5a8e
author: Sijia Chen <sijchen@cisco.com>
date: Mon Nov 24 11:11:52 EST 2014

add one more conditin for statistics printing to avoid timestamp problem

--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -640,11 +640,13 @@
 
   if (m_pEncContext->iStatisticsLogInterval > 0) {
     int64_t iTimeDiff = kiCurrentFrameTs - m_pEncContext->iLastStatisticsLogTs;
-    if (iTimeDiff > m_pEncContext->iStatisticsLogInterval) {
-      pStatistics->fLatestFrameRate = (pStatistics->uiInputFrameCount - m_pEncContext->iLastStatisticsFrameCount) * 1000 /
-                                      iTimeDiff;
-      pStatistics->uiBitRate = static_cast<unsigned int> ((m_pEncContext->iTotalEncodedBits -
-                               m_pEncContext->iLastStatisticsBits) * 1000 / iTimeDiff);
+    if (iTimeDiff > m_pEncContext->iStatisticsLogInterval || 0 == pStatistics->uiInputFrameCount % 300) {
+      if (iTimeDiff) {
+        pStatistics->fLatestFrameRate = (pStatistics->uiInputFrameCount - m_pEncContext->iLastStatisticsFrameCount) * 1000 /
+                                        iTimeDiff;
+        pStatistics->uiBitRate = static_cast<unsigned int> ((m_pEncContext->iTotalEncodedBits -
+                                                             m_pEncContext->iLastStatisticsBits) * 1000 / iTimeDiff);
+      }
 
       // update variables
       m_pEncContext->iLastStatisticsLogTs = kiCurrentFrameTs;