Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 4 files). Show all
Unified · Split
| @@ -402,7 +402,14 @@ int CWelsH264SVCEncoder::EncodeFrame (const SSourcePicture* kpSrcPic, SFrameBSIn · 401 unmodified lines | |||
| 402 | 402 | ||
| 403 | int CWelsH264SVCEncoder ::EncodeFrameInternal (const SSourcePicture* pSrcPic, SFrameBSInfo* pBsInfo) { | 403 | int CWelsH264SVCEncoder ::EncodeFrameInternal (const SSourcePicture* pSrcPic, SFrameBSInfo* pBsInfo) { |
| 404 | const int64_t kiBeforeFrameUs = WelsTime(); | 404 | const int64_t kiBeforeFrameUs = WelsTime(); |
| 405 | const int32_t kiEncoderReturn = WelsEncoderEncodeExt (m_pEncContext, pBsInfo, pSrcPic); | 405 | int64_t uiTimeStamp = pSrcPic->uiTimeStamp; |
| 406 | if ((m_pEncContext->uiLastTimestamp == uiTimeStamp) || ((uiTimeStamp == 0) && (m_pEncContext->uiLastTimestamp != -1))) { | ||
| 407 | uiTimeStamp = m_pEncContext->uiLastTimestamp + (int32_t) (1000.0 / | ||
| 408 | m_pEncContext->pSvcParam->sSpatialLayers->fFrameRate); | ||
| 409 | } | ||
| 410 | m_pEncContext->uiLastTimestamp = uiTimeStamp; | ||
| 411 | |||
| 412 | const int32_t kiEncoderReturn = WelsEncoderEncodeExt (m_pEncContext, pBsInfo, pSrcPic, uiTimeStamp); | ||
| 406 | const int64_t kiCurrentFrameMs = (WelsTime() - kiBeforeFrameUs) / 1000; | 413 | const int64_t kiCurrentFrameMs = (WelsTime() - kiBeforeFrameUs) / 1000; |
| 407 | 414 | ||
| 408 | if ((kiEncoderReturn == ENC_RETURN_MEMALLOCERR) || (kiEncoderReturn == ENC_RETURN_MEMOVERFLOWFOUND) | 415 | if ((kiEncoderReturn == ENC_RETURN_MEMALLOCERR) || (kiEncoderReturn == ENC_RETURN_MEMOVERFLOWFOUND) |
| @@ -415,7 +422,7 @@ int CWelsH264SVCEncoder ::EncodeFrameInternal (const SSourcePicture* pSrcPic, S · 6 unmodified lines | |||
| 415 | return cmUnknownReason; | 422 | return cmUnknownReason; |
| 416 | } | 423 | } |
| 417 | 424 | ||
| 418 | UpdateStatistics (pSrcPic->uiTimeStamp, pBsInfo, kiCurrentFrameMs); | 425 | UpdateStatistics (uiTimeStamp, pBsInfo, kiCurrentFrameMs); |
| 419 | 426 | ||
| 420 | ///////////////////for test | 427 | ///////////////////for test |
| 421 | #ifdef OUTPUT_BIT_STREAM | 428 | #ifdef OUTPUT_BIT_STREAM |
| @@ -582,7 +589,7 @@ void CWelsH264SVCEncoder::UpdateStatistics (const int64_t kiCurrentFrameTs, SFra · 160 unmodified lines | |||
| 582 | if ((pLayerInfo->uiLayerType == VIDEO_CODING_LAYER) && (pLayerInfo->uiSpatialId == iDid)) { | 589 | if ((pLayerInfo->uiLayerType == VIDEO_CODING_LAYER) && (pLayerInfo->uiSpatialId == iDid)) { |
| 583 | eFrameType = pLayerInfo->eFrameType; | 590 | eFrameType = pLayerInfo->eFrameType; |
| 584 | for (int32_t iNalIdx = 0; iNalIdx < pLayerInfo->iNalCount; iNalIdx++) { | 591 | for (int32_t iNalIdx = 0; iNalIdx < pLayerInfo->iNalCount; iNalIdx++) { |
| 585 | kiCurrentFrameSize += pLayerInfo->pNalLengthInByte[iNalIdx]; | 592 | kiCurrentFrameSize += pLayerInfo->pNalLengthInByte[iNalIdx]; |
| 586 | } | 593 | } |
| 587 | } | 594 | } |
| 588 | } | 595 | } |