Fix FrameStabilityContainer performing frame-stable seeks

This commit is contained in:
Dean Herbert 2019-04-24 13:44:21 +09:00
parent 65f5318298
commit 80e1568e97
1 changed files with 10 additions and 1 deletions

View File

@ -68,6 +68,8 @@ protected override void LoadComplete()
private const double sixty_frame_time = 1000.0 / 60;
private bool firstConsumption = true;
public override bool UpdateSubTree()
{
requireMoreUpdateLoops = true;
@ -103,7 +105,14 @@ private void updateClock()
try
{
if (Math.Abs(manualClock.CurrentTime - newProposedTime) > sixty_frame_time * 1.2f)
if (firstConsumption)
{
// On the first update, frame-stability seeking would result in unexpected/unwanted behaviour.
// Instead we perform an initial seek to the proposed time.
manualClock.CurrentTime = newProposedTime;
firstConsumption = false;
}
else if (Math.Abs(manualClock.CurrentTime - newProposedTime) > sixty_frame_time * 1.2f)
{
newProposedTime = newProposedTime > manualClock.CurrentTime
? Math.Min(newProposedTime, manualClock.CurrentTime + sixty_frame_time)