History

fix timestamp = 0 issue when rc mode is BITRATE mode

sijchen committed 10 years ago

Commit 9816e331 parent 597b4ee6 files · +26 −22Browse files

Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 6 files). Show all

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+10−10
@@ -3716,7 +3716,7 @@ void ClearFrameBsInfo (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi) { · 3715 unmodified lines
37163716 * \pParam pSrcPic Source Picture
37173717 * \return EFrameType (videoFrameTypeIDR/videoFrameTypeI/videoFrameTypeP)
37183718 */
3719−int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSourcePicture* pSrcPic,int64_t uiTimeStamp ) {
3719+int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSourcePicture* pSrcPic ) {
37203720 if (pCtx == NULL) {
37213721 return ENC_RETURN_MEMALLOCERR;
37223722 }
@@ -3756,14 +3756,14 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 33 unmodified lines
37563756 pCtx->iEncoderError = ENC_RETURN_SUCCESS;
37573757 pCtx->bCurFrameMarkedAsSceneLtr = false;
37583758 pFbi->iLayerNum = 0; // for initialization
3759− pFbi->uiTimeStamp = uiTimeStamp;
3759+ pFbi->uiTimeStamp = GetTimestampForRc(pSrcPic->uiTimeStamp, pCtx->uiLastTimestamp, pCtx->pSvcParam->sSpatialLayers->fFrameRate);
37603760 for (int32_t iNalIdx = 0; iNalIdx < MAX_LAYER_NUM_OF_FRAME; iNalIdx++) {
37613761 pFbi->sLayerInfo[iNalIdx].eFrameType = videoFrameTypeSkip;
37623762 }
37633763 // perform csc/denoise/downsample/padding, generate spatial layers
37643764 iSpatialNum = pCtx->pVpp->BuildSpatialPicList (pCtx, pSrcPic);
37653765 if (pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus) {
3766− pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus (pCtx, iSpatialNum,uiTimeStamp);
3766+ pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus (pCtx, iSpatialNum, pFbi->uiTimeStamp);
37673767 }
37683768
37693769 if (iSpatialNum < 1) {
@@ -3809,7 +3809,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 39 unmodified lines
38093809 pLayerBsInfo->eFrameType = eFrameType;
38103810 WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
38113811 "[Rc] Frame timestamp = %lld, skip one frame due to target_br, continual skipped %d frames",
3812− uiTimeStamp, pCtx->iContinualSkipFrames);
3812+ pFbi->uiTimeStamp, pCtx->iContinualSkipFrames);
38133813 ++ iSpatialIdx;
38143814 if (pSvcParam->bSimulcastAVC) {
38153815 if (pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip)
@@ -3830,13 +3830,13 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 14 unmodified lines
38303830 //loop each layer to check if have skip frame when RC and frame skip enable
38313831 if (pCtx->pFuncList->pfRc.pfWelsCheckSkipBasedMaxbr) {
38323832 bool bSkip = pCtx->pFuncList->pfRc.pfWelsCheckSkipBasedMaxbr (pCtx, iSpatialNum, eFrameType,
3833− (uint32_t)uiTimeStamp);
3833+ (uint32_t)pFbi->uiTimeStamp);
38343834 if (bSkip) {
38353835 eFrameType = videoFrameTypeSkip;
38363836 pLayerBsInfo->eFrameType = videoFrameTypeSkip;
38373837 WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
38383838 "[Rc] Frame timestamp = %lld, skip one frame due to max_br, continual skipped %d frames",
3839− uiTimeStamp, pCtx->iContinualSkipFrames);
3839+ pFbi->uiTimeStamp, pCtx->iContinualSkipFrames);
38403840 ++ iSpatialIdx;
38413841 if (pSvcParam->bSimulcastAVC)
38423842 continue;
@@ -3968,7 +3968,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 125 unmodified lines
39683968 eFrameType); //get reordering syntax used for writing slice header and transmit to encoder.
39693969 PrefetchReferencePicture (pCtx, eFrameType); // update reference picture for current pDq layer
39703970
3971− pCtx->pFuncList->pfRc.pfWelsRcPictureInit (pCtx, uiTimeStamp);
3971+ pCtx->pFuncList->pfRc.pfWelsRcPictureInit (pCtx, pFbi->uiTimeStamp);
39723972 PreprocessSliceCoding (pCtx); // MUST be called after pfWelsRcPictureInit() and WelsInitCurrentLayer()
39733973
39743974 //TODO Complexity Calculation here for screen content
@@ -4166,7 +4166,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 191 unmodified lines
41664166 }
41674167
41684168 if (NULL != pCtx->pFuncList->pfRc.pfWelsRcPostFrameSkipping
4169− && pCtx->pFuncList->pfRc.pfWelsRcPostFrameSkipping (pCtx, iCurDid,uiTimeStamp)) {
4169+ && pCtx->pFuncList->pfRc.pfWelsRcPostFrameSkipping (pCtx, iCurDid, pFbi->uiTimeStamp)) {
41704170
41714171 StackBackEncoderStatus (pCtx, eFrameType);
41724172 ClearFrameBsInfo (pCtx, pFbi);
@@ -4182,7 +4182,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 9 unmodified lines
41824182 WelsRcPostFrameSkippedUpdate (pCtx, iCurDid);
41834183 WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO,
41844184 "[Rc] Frame timestamp = %lld, skip one frame due to post skip, continual skipped %d frames",
4185− uiTimeStamp, pCtx->iContinualSkipFrames);
4185+ pFbi->uiTimeStamp, pCtx->iContinualSkipFrames);
41864186 pCtx->iEncoderError = ENC_RETURN_SUCCESS;
41874187 return ENC_RETURN_SUCCESS;
41884188 }
@@ -4200,7 +4200,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 11 unmodified lines
42004200 }
42014201
42024202 pCtx->pFuncList->pfRc.pfWelsRcPictureInfoUpdate (pCtx, iLayerSize);
4203− RcTraceFrameBits (pCtx,uiTimeStamp);
4203+ RcTraceFrameBits (pCtx, pFbi->uiTimeStamp);
42044204 pCtx->pDecPic->iFrameAverageQp = pCtx->pWelsSvcRc[iDidIdx].iAverageFrameQp;
42054205
42064206 //update scc related

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t