shithub: openh264

Download patch

ref: f1fb0d6b6980e9705147fcdba2acd80ed6eba5b8
parent: 48e79d51b593271b8fd8dbd273aab2fc6b0b5a8e
parent: 3be7e9022185816ef384343fcc06126e92afd350
author: ruil2 <ruil2@cisco.com>
date: Tue Nov 25 06:20:38 EST 2014

Merge pull request #1548 from sijchen/after_review

[Encoder] add one more condition for statistics printing to avoid potential 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;