1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 12:53:11 +08:00

Set clock on video directly; ignore long frames

This commit is contained in:
Dean Herbert 2019-11-08 17:13:45 +09:00
parent 5fe764b2db
commit 380859e06e

View File

@ -16,8 +16,7 @@ namespace osu.Game.Tournament.Components
{ {
private readonly VideoSprite video; private readonly VideoSprite video;
private ManualClock manualClock; private readonly ManualClock manualClock;
private IFrameBasedClock sourceClock;
public TourneyVideo(Stream stream) public TourneyVideo(Stream stream)
{ {
@ -34,6 +33,7 @@ namespace osu.Game.Tournament.Components
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit, FillMode = FillMode.Fit,
Clock = new FramedClock(manualClock = new ManualClock())
}; };
} }
@ -46,21 +46,16 @@ namespace osu.Game.Tournament.Components
} }
} }
protected override void LoadComplete()
{
base.LoadComplete();
sourceClock = Clock;
Clock = new FramedClock(manualClock = new ManualClock());
}
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
// we want to avoid seeking as much as possible, because we care about performance, not sync. if (manualClock != null && Clock.ElapsedFrameTime < 100)
// to avoid seeking completely, we only increment out local clock when in an updating state. {
manualClock.CurrentTime += sourceClock.ElapsedFrameTime; // we want to avoid seeking as much as possible, because we care about performance, not sync.
// to avoid seeking completely, we only increment out local clock when in an updating state.
manualClock.CurrentTime += Clock.ElapsedFrameTime;
}
} }
} }
} }