add some warning traces in case the setting of frame rate has problem

This commit is contained in:
Sijia Chen 2015-05-26 14:49:46 +08:00
parent d15afbbee0
commit 585b61626c
2 changed files with 18 additions and 3 deletions

View File

@ -626,7 +626,7 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
int FillSpecificParameters (SEncParamExt& sParam) {
/* Test for temporal, spatial, SNR scalability */
sParam.iUsageType = CAMERA_VIDEO_REAL_TIME;
sParam.fMaxFrameRate = 30.0f; // input frame rate
sParam.fMaxFrameRate = 60.0f; // input frame rate
sParam.iPicWidth = 1280; // width of picture in samples
sParam.iPicHeight = 720; // height of picture in samples
sParam.iTargetBitrate = 2500000; // target bitrate desired

View File

@ -559,7 +559,7 @@ void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVid
pStatistics->uiSkippedFrameCount += (kbCurrentFrameSkipped ? 1 : 0);
int32_t iProcessedFrameCount = pStatistics->uiInputFrameCount - pStatistics->uiSkippedFrameCount;
if (!kbCurrentFrameSkipped && iProcessedFrameCount != 0) {
pStatistics->fAverageFrameSpeedInMs += (kiCurrentFrameMs - pStatistics->fAverageFrameSpeedInMs)/iProcessedFrameCount;
pStatistics->fAverageFrameSpeedInMs += (kiCurrentFrameMs - pStatistics->fAverageFrameSpeedInMs) / iProcessedFrameCount;
}
// rate control related
@ -586,7 +586,7 @@ void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVid
const int32_t kiDeltaFrames = static_cast<int32_t> (pStatistics->uiInputFrameCount -
m_pEncContext->iLastStatisticsFrameCount);
if (kiDeltaFrames > m_pEncContext->pSvcParam->fMaxFrameRate) {
if (kiDeltaFrames > (m_pEncContext->pSvcParam->fMaxFrameRate * 2)) {
const int64_t kiTimeDiff = kiCurrentFrameTs - pStatistics->iStatisticsTs;
if (kiTimeDiff) {
pStatistics->fLatestFrameRate = static_cast<float> ((pStatistics->uiInputFrameCount -
@ -596,6 +596,14 @@ void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVid
m_pEncContext->iLastStatisticsBytes) * 8 * 1000 / kiTimeDiff);
}
if (m_pEncContext->pSvcParam->iRCMode == RC_QUALITY_MODE || m_pEncContext->pSvcParam->iRCMode == RC_BITRATE_MODE) {
if (WELS_ABS (pStatistics->fLatestFrameRate - m_pEncContext->pSvcParam->fMaxFrameRate) > 5) {
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING,
"Actual Input Framerate %f is different from framerate in setting %f, suggest to use other rate control modes",
pStatistics->fLatestFrameRate, m_pEncContext->pSvcParam->fMaxFrameRate);
}
}
// update variables
pStatistics->iStatisticsTs = kiCurrentFrameTs;
m_pEncContext->iLastStatisticsBytes = m_pEncContext->iTotalEncodedBytes;
@ -607,6 +615,13 @@ void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, EVid
if (m_pEncContext->iStatisticsLogInterval > 0) {
const int64_t kiTimeDiff = kiCurrentFrameTs - m_pEncContext->iLastStatisticsLogTs;
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 %f is quite different from framerate in setting %f, please check setting or timestamp unit (ms)",
pStatistics->fAverageFrameRate, m_pEncContext->pSvcParam->fMaxFrameRate);
}
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, "