shithub: openh264

Download patch

ref: 881fc11c48bb229e344f89f948b011e2e38dc82b
parent: 9816e3302d06892e6cc4aba04d151b99846b8b19
author: sijchen <sijchen@cisco.com>
date: Mon Feb 22 05:40:35 EST 2016

finish the remaining prob of fixing ts=0

--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -3756,7 +3756,7 @@
   pCtx->iEncoderError = ENC_RETURN_SUCCESS;
   pCtx->bCurFrameMarkedAsSceneLtr = false;
   pFbi->iLayerNum = 0; // for initialization
-  pFbi->uiTimeStamp = GetTimestampForRc(pSrcPic->uiTimeStamp, pCtx->uiLastTimestamp, pCtx->pSvcParam->sSpatialLayers->fFrameRate);
+  pFbi->uiTimeStamp = GetTimestampForRc(pSrcPic->uiTimeStamp, pCtx->uiLastTimestamp, pCtx->pSvcParam->sSpatialLayers[pCtx->pSvcParam->iSpatialLayerNum-1].fFrameRate);
   for (int32_t iNalIdx = 0; iNalIdx < MAX_LAYER_NUM_OF_FRAME; iNalIdx++) {
     pFbi->sLayerInfo[iNalIdx].eFrameType = videoFrameTypeSkip;
   }
--- a/codec/encoder/core/src/ratectl.cpp
+++ b/codec/encoder/core/src/ratectl.cpp
@@ -1542,7 +1542,7 @@
 }
 
 long long GetTimestampForRc(const long long uiTimeStamp, const long long uiLastTimeStamp, const float fFrameRate) {
-  if ((uiLastTimeStamp == uiTimeStamp) || ((uiTimeStamp == 0) && (uiLastTimeStamp != -1))) {
+  if ((uiLastTimeStamp >= uiTimeStamp) || ((uiTimeStamp == 0) && (uiLastTimeStamp != -1))) {
     return (uiLastTimeStamp + (int32_t) (1000.0 / fFrameRate));
   }
   return uiTimeStamp;