shithub: openh264

Download patch

ref: f280a71c3f300d5d42a563bc9ae21bff46a6d7aa
parent: 68ab668707299c3a705135f5114fead8b0a1b0b7
parent: 52d49f3735f9dd9f32a3ed13aa225b049d7b263f
author: guangwei <GuangweiWang@users.noreply.github.com>
date: Tue Dec 26 07:02:05 EST 2017

Merge pull request #2889 from ruil2/statistics

fix uncorrect statistics info issue

--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -638,7 +638,7 @@
     const int32_t kiDeltaFrames = static_cast<int32_t> (pStatistics->uiInputFrameCount -
                                   pStatistics->iLastStatisticsFrameCount);
     if (kiDeltaFrames > (m_pEncContext->pSvcParam->fMaxFrameRate * 2)) {
-      if (kiTimeDiff > m_pEncContext->iStatisticsLogInterval) {
+      if (kiTimeDiff >= m_pEncContext->iStatisticsLogInterval) {
         pStatistics->fLatestFrameRate = static_cast<float> ((pStatistics->uiInputFrameCount -
                                         pStatistics->iLastStatisticsFrameCount) * 1000 /
                                         kiTimeDiff);
@@ -661,17 +661,17 @@
                      pStatistics->fLatestFrameRate, m_pEncContext->pSvcParam->fMaxFrameRate);
           }
         }
-      }
+        // update variables
+        pStatistics->iLastStatisticsBytes = pStatistics->iTotalEncodedBytes;
+        pStatistics->iLastStatisticsFrameCount = pStatistics->uiInputFrameCount;
 
-      // update variables
-      pStatistics->iLastStatisticsBytes = pStatistics->iTotalEncodedBytes;
-      pStatistics->iLastStatisticsFrameCount = pStatistics->uiInputFrameCount;
+        //TODO: the following statistics will be calculated and added later
+        //pStatistics->uiLTRSentNum
 
-      //TODO: the following statistics will be calculated and added later
-      //pStatistics->uiLTRSentNum
+      }
     }
   }
-  if (((m_pEncContext->iStatisticsLogInterval > 0) && (kiTimeDiff > m_pEncContext->iStatisticsLogInterval))
+  if (((m_pEncContext->iStatisticsLogInterval > 0) && (kiTimeDiff >= m_pEncContext->iStatisticsLogInterval))
       || (0 == iMaxInputFrame % 300)) {
 
     if ((iMaxFrameRate > 0) && WELS_ABS (iMaxFrameRate - m_pEncContext->pSvcParam->fMaxFrameRate) > 30) {