From 380859e06e11137716ec7b2748214a58a213b0b4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 8 Nov 2019 17:13:45 +0900 Subject: [PATCH] Set clock on video directly; ignore long frames --- .../Components/TourneyVideo.cs | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tournament/Components/TourneyVideo.cs b/osu.Game.Tournament/Components/TourneyVideo.cs index f28a2773b6..8582b1634c 100644 --- a/osu.Game.Tournament/Components/TourneyVideo.cs +++ b/osu.Game.Tournament/Components/TourneyVideo.cs @@ -16,8 +16,7 @@ namespace osu.Game.Tournament.Components { private readonly VideoSprite video; - private ManualClock manualClock; - private IFrameBasedClock sourceClock; + private readonly ManualClock manualClock; public TourneyVideo(Stream stream) { @@ -34,6 +33,7 @@ namespace osu.Game.Tournament.Components { RelativeSizeAxes = Axes.Both, 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() { base.Update(); - // 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 += sourceClock.ElapsedFrameTime; + if (manualClock != null && Clock.ElapsedFrameTime < 100) + { + // 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; + } } } }