Merge pull request #2195 from sijchen/add_stat_log
[Encoder] Log enhancement for easier debugging
This commit is contained in:
commit
0292647449
@ -3448,6 +3448,9 @@ int32_t ForceCodingIDR (sWelsEncCtx* pCtx) {
|
||||
pCtx->bEncCurFrmAsIdrFlag = true;
|
||||
pCtx->iCodingIndex = 0;
|
||||
pCtx->bCheckWindowStatusRefreshFlag = false;
|
||||
|
||||
WelsLog (&pCtx->sLogCtx, WELS_LOG_INFO, "ForceCodingIDR at InputFrameCount=%d\n",
|
||||
pCtx->sEncoderStatistics.uiInputFrameCount);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -99,6 +99,7 @@ class CWelsH264SVCEncoder : public ISVCEncoder {
|
||||
private:
|
||||
int InitializeInternal (SWelsSvcCodingParam* argv);
|
||||
void TraceParamInfo(SEncParamExt *pParam);
|
||||
void LogStatistics (const int64_t kiCurrentFrameTs);
|
||||
void UpdateStatistics(const int64_t kiCurrentFrameTs, EVideoFrameType eFrameType, const int32_t kiCurrentFrameSize, const int64_t kiCurrentFrameMs);
|
||||
|
||||
sWelsEncCtx* m_pEncContext;
|
||||
|
@ -475,8 +475,8 @@ int CWelsH264SVCEncoder::ForceIntraFrame (bool bIDR) {
|
||||
if (! (m_pEncContext && m_bInitialFlag)) {
|
||||
return 1;
|
||||
}
|
||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||
"CWelsH264SVCEncoder::ForceIntraFrame(), bIDR= %d", bIDR);
|
||||
//WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||
// "CWelsH264SVCEncoder::ForceIntraFrame(), bIDR= %d", bIDR);
|
||||
|
||||
ForceCodingIDR (m_pEncContext);
|
||||
|
||||
@ -541,6 +541,21 @@ void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) {
|
||||
}
|
||||
}
|
||||
|
||||
void CWelsH264SVCEncoder::LogStatistics (const int64_t kiCurrentFrameTs) {
|
||||
SEncoderStatistics* pStatistics = & (m_pEncContext->sEncoderStatistics);
|
||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||
"EncoderStatistics: %dx%d, SpeedInMs: %f, fAverageFrameRate=%f, "
|
||||
"LastFrameRate=%f, LatestBitRate=%d, LastFrameQP=%d, uiInputFrameCount=%d, uiSkippedFrameCount=%d, "
|
||||
"uiResolutionChangeTimes=%d, uIDRReqNum=%d, uIDRSentNum=%d, uLTRSentNum=NA, iTotalEncodedBytes=%" PRId64
|
||||
" at Ts = %" PRId64,
|
||||
pStatistics->uiWidth, pStatistics->uiHeight,
|
||||
pStatistics->fAverageFrameSpeedInMs, pStatistics->fAverageFrameRate,
|
||||
pStatistics->fLatestFrameRate, pStatistics->uiBitRate, pStatistics->uiAverageFrameQP,
|
||||
pStatistics->uiInputFrameCount, pStatistics->uiSkippedFrameCount,
|
||||
pStatistics->uiResolutionChangeTimes, pStatistics->uiIDRReqNum, pStatistics->uiIDRSentNum,
|
||||
m_pEncContext->iTotalEncodedBytes, kiCurrentFrameTs);
|
||||
}
|
||||
|
||||
void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVideoFrameType eFrameType,
|
||||
const int32_t kiCurrentFrameSize, const int64_t kiCurrentFrameMs) {
|
||||
SEncoderStatistics* pStatistics = & (m_pEncContext->sEncoderStatistics);
|
||||
@ -624,21 +639,12 @@ void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVid
|
||||
if ((kiTimeDiff > m_pEncContext->iStatisticsLogInterval) || (0 == pStatistics->uiInputFrameCount % 300)) {
|
||||
if (WELS_ABS (pStatistics->fAverageFrameRate - m_pEncContext->pSvcParam->fMaxFrameRate) > 30) {
|
||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING,
|
||||
"Actual input framerate fAverageFrameRate = %f is quite different from framerate in setting %f, please check setting or timestamp unit (ms), start_Ts = %" PRId64,
|
||||
"Actual input framerate fAverageFrameRate = %f is quite different from framerate in setting %f, please check setting or timestamp unit (ms), start_Ts = %"
|
||||
PRId64,
|
||||
pStatistics->fAverageFrameRate, m_pEncContext->pSvcParam->fMaxFrameRate, m_pEncContext->uiStartTimestamp);
|
||||
}
|
||||
|
||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||
"EncoderStatistics: %dx%d, SpeedInMs: %f, fAverageFrameRate=%f, "
|
||||
"LastFrameRate=%f, LatestBitRate=%d, LastFrameQP=%d, uiInputFrameCount=%d, uiSkippedFrameCount=%d, "
|
||||
"uiResolutionChangeTimes=%d, uIDRReqNum=%d, uIDRSentNum=%d, uLTRSentNum=NA, iTotalEncodedBytes=%" PRId64
|
||||
" at Ts = %" PRId64,
|
||||
pStatistics->uiWidth, pStatistics->uiHeight,
|
||||
pStatistics->fAverageFrameSpeedInMs, pStatistics->fAverageFrameRate,
|
||||
pStatistics->fLatestFrameRate, pStatistics->uiBitRate, pStatistics->uiAverageFrameQP,
|
||||
pStatistics->uiInputFrameCount, pStatistics->uiSkippedFrameCount,
|
||||
pStatistics->uiResolutionChangeTimes, pStatistics->uiIDRReqNum, pStatistics->uiIDRSentNum,
|
||||
m_pEncContext->iTotalEncodedBytes, kiCurrentFrameTs);
|
||||
LogStatistics (kiCurrentFrameTs);
|
||||
m_pEncContext->iLastStatisticsLogTs = kiCurrentFrameTs;
|
||||
}
|
||||
}
|
||||
@ -772,6 +778,11 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
|
||||
if (WelsEncoderParamAdjust (&m_pEncContext, &sConfig)) {
|
||||
return cmInitParaError;
|
||||
}
|
||||
|
||||
//LogStatistics
|
||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||
"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, LogStatisticsBeforeNewEncoding");
|
||||
LogStatistics (m_pEncContext->iLastStatisticsLogTs);
|
||||
}
|
||||
break;
|
||||
case ENCODER_OPTION_FRAME_RATE: { // Maximal input frame rate
|
||||
|
Loading…
x
Reference in New Issue
Block a user