mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 15:43:22 +08:00
Set clock on video directly; ignore long frames
This commit is contained in:
parent
5fe764b2db
commit
380859e06e
@ -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();
|
||||||
|
|
||||||
|
if (manualClock != null && Clock.ElapsedFrameTime < 100)
|
||||||
|
{
|
||||||
// we want to avoid seeking as much as possible, because we care about performance, not sync.
|
// 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.
|
// to avoid seeking completely, we only increment out local clock when in an updating state.
|
||||||
manualClock.CurrentTime += sourceClock.ElapsedFrameTime;
|
manualClock.CurrentTime += Clock.ElapsedFrameTime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user