shithub: openh264

Download patch

ref: 4c8458f7ffa93168aee032d57cec012d302c893a
parent: 106d13d26c46267bbdf73f34ce22a318e4afa414
parent: 40f4fc05bb9134896e7021c2e0acd5388222c069
author: sijchen <sijchen@cisco.com>
date: Tue Jun 7 10:41:12 EDT 2016

Merge pull request #2494 from ruil2/stat

use the correct frametype in statistics info

--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -574,21 +574,16 @@
   int32_t iMaxDid = m_pEncContext->pSvcParam->iSpatialLayerNum - 1;
   SLayerBSInfo*  pLayerInfo = &pBsInfo->sLayerInfo[0];
   for (int32_t iDid = 0; iDid <= iMaxDid; iDid++) {
-    EVideoFrameType eFrameType = pBsInfo->eFrameType;
+    EVideoFrameType eFrameType = videoFrameTypeSkip;
     int32_t kiCurrentFrameSize = 0;
-    if (pBsInfo->eFrameType == videoFrameTypeSkip) {
-      eFrameType = videoFrameTypeSkip;
-    } else {
-      for (int32_t iLayerNum = 0; iLayerNum < pBsInfo->iLayerNum; iLayerNum++) {
-        pLayerInfo = &pBsInfo->sLayerInfo[iLayerNum];
-        if ((pLayerInfo->uiLayerType == VIDEO_CODING_LAYER) && (pLayerInfo->uiSpatialId == iDid)) {
-          eFrameType = pLayerInfo->eFrameType;
-          for (int32_t iNalIdx = 0; iNalIdx < pLayerInfo->iNalCount; iNalIdx++) {
-            kiCurrentFrameSize += pLayerInfo->pNalLengthInByte[iNalIdx];
-          }
+    for (int32_t iLayerNum = 0; iLayerNum < pBsInfo->iLayerNum; iLayerNum++) {
+      pLayerInfo = &pBsInfo->sLayerInfo[iLayerNum];
+      if ((pLayerInfo->uiLayerType == VIDEO_CODING_LAYER) && (pLayerInfo->uiSpatialId == iDid)) {
+        eFrameType = pLayerInfo->eFrameType;
+        for (int32_t iNalIdx = 0; iNalIdx < pLayerInfo->iNalCount; iNalIdx++) {
+          kiCurrentFrameSize += pLayerInfo->pNalLengthInByte[iNalIdx];
         }
       }
-
     }
     SEncoderStatistics* pStatistics = & (m_pEncContext->sEncoderStatistics[iDid]);
 
@@ -619,7 +614,7 @@
     }
     //pStatistics->fLatestFrameRate = m_pEncContext->pWelsSvcRc->fLatestFrameRate; //TODO: finish the calculation in RC
     //pStatistics->uiBitRate = m_pEncContext->pWelsSvcRc->iActualBitRate; //TODO: finish the calculation in RC
-    pStatistics->uiAverageFrameQP = m_pEncContext->pWelsSvcRc->iAverageFrameQp;
+    pStatistics->uiAverageFrameQP = m_pEncContext->pWelsSvcRc[iDid].iAverageFrameQp;
 
     if (videoFrameTypeIDR == eFrameType || videoFrameTypeI == eFrameType) {
       pStatistics->uiIDRSentNum ++;
@@ -1065,7 +1060,8 @@
     if (m_pWelsTrace) {
       WelsTraceCallback callback = * ((WelsTraceCallback*)pOption);
       m_pWelsTrace->SetTraceCallback (callback);
-      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_TRACE_CALLBACK callback = %p.",
+      WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
+               "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_TRACE_CALLBACK callback = %p.",
                callback);
     }
   }