![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <TimecodeEstimator.h>
Public Member Functions | |
| UE_API | FTimecodeEstimator (SIZE_T InNumSamples, UTimecodeProvider &InTimecode UE_LIFETIMEBOUND, IClockedTimeStep &InEngineCustomTimeStep UE_LIFETIMEBOUND) |
| UE_API TOptional< FFetchAndUpdateStats > | FetchAndUpdate () |
| UE_API FQualifiedFrameTime | EstimateFrameTime () const |
Estimates the current timecode based on an IClockedTimeStep implementation, which is designed to be an UEngineCustomTimeStep.
The engine starts each frame by calling UEngineCustomTimeStep::UpdateTimeStep. Then, using UTimecodeProvider::FetchAndUpdate, the engine calls FApp::SetCurrentFrameTime with the result of UTimecodeProvider::GetQualifiedFrameTime. Workflow:
If coupled with a UEngineCustomTimeStep that implements a fixed engine step rate, we can effectively handle hitching game frames, i.e. when frames take longer than the frame rate dedicated by the time code provider. Some systems, like Live Link, are used for querying external data; for the look-up, we use the frame's time code of the frame. However, when a frame takes longer, the subsequent frame needs to use the timecode value that was intended for that frame. The previous engine behaviour was to use FPlatformTime::Seconds() to determine the timecode the frame should have, which can cause the subsequent frame to inherit frame hitches.
Explaining the issue with an example (TC = timecode):
|
explicit |
| InNumSamples | The number of samples to used for linear regression. |
| InTimecode | The timecoder provider for which we estimate the current frame's time. Caller ensures this outlives the constructed FTimecodeEstimator. |
| InEngineCustomTimeStep | The provider of the current clock time. Caller ensures this outlives the constructed FTimecodeEstimator. |
| FQualifiedFrameTime UE::TimeManagement::TimecodeEstimation::FTimecodeEstimator::EstimateFrameTime | ( | ) | const |
Estimates what the current frame time should be given FApp::CurrentTime's value.
| TOptional< FFetchAndUpdateStats > UE::TimeManagement::TimecodeEstimation::FTimecodeEstimator::FetchAndUpdate | ( | ) |
Samples the current timecode and associates it with the underlying clock value.