shithub: openh264

Download patch

ref: 52d49f3735f9dd9f32a3ed13aa225b049d7b263f
parent: 68ab668707299c3a705135f5114fead8b0a1b0b7
author: ruil2 <[email protected]>
date: Tue Dec 26 05:31:45 EST 2017

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) {