ref: ab480fe3870dde09b13d7d384ccc7a9400d3ee16
parent: 58e868c0741b8e2c7c3c8ea65ff47148527d9dc6
parent: 1b26bd4b88bca28c502ec5887a53bc873d075925
author: ruil2 <ruil2@cisco.com>
date: Wed Dec 17 11:05:32 EST 2014
Merge pull request #1649 from sijchen/fix_trace [Encoder] fix a potential problem of trace
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -550,7 +550,9 @@
pParam->iLoopFilterDisableIdc
);
int32_t i = 0;
- while (i < pParam->iSpatialLayerNum) {
+ int32_t iSpatialLayers = (pParam->iSpatialLayerNum < MAX_SPATIAL_LAYER_NUM) ? (pParam->iSpatialLayerNum) :
+ MAX_SPATIAL_LAYER_NUM;
+ while (i < iSpatialLayers) {
SSpatialLayerConfig* pSpatialCfg = &pParam->sSpatialLayers[i];
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
"sSpatialLayers[%d]: .iVideoWidth= %d; .iVideoHeight= %d; .fFrameRate= %.6ff; .iSpatialBitrate= %d; .iMaxSpatialBitrate= %d; .sSliceCfg.uiSliceMode= %d; .sSliceCfg.sSliceArgument.iSliceNum= %d; .sSliceCfg.sSliceArgument.uiSliceSizeConstraint= %d;\
@@ -1046,8 +1048,9 @@
break;
case ENCODER_OPTION_BITS_VARY_PERCENTAGE: {
int32_t iValue = * (static_cast<int32_t*> (pOption));
- m_pEncContext->pSvcParam->iBitsVaryPercentage = WELS_CLIP3(iValue,0,100);
- WelsEncoderApplyBitVaryRang(&m_pWelsTrace->m_sLogCtx, m_pEncContext->pSvcParam, m_pEncContext->pSvcParam->iBitsVaryPercentage);
+ m_pEncContext->pSvcParam->iBitsVaryPercentage = WELS_CLIP3 (iValue, 0, 100);
+ WelsEncoderApplyBitVaryRang (&m_pWelsTrace->m_sLogCtx, m_pEncContext->pSvcParam,
+ m_pEncContext->pSvcParam->iBitsVaryPercentage);
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITS_VARY_PERCENTAGE,iBitsVaryPercentage = %d", iValue);
}