mirror of https://github.com/ppy/osu
Clamp `SpectatorPlayerClock`'s elapsed calculation to avoid player clocks getting too far ahead
This commit is contained in:
parent
a8c699610a
commit
a546aa2673
|
@ -80,7 +80,8 @@ public void ProcessFrame()
|
|||
// When in catch-up mode, the source is usually not running.
|
||||
// In such a case, its elapsed time may be zero, which would cause catch-up to get stuck.
|
||||
// To avoid this, use a constant 16ms elapsed time for now. Probably not too correct, but this whole logic isn't too correct anyway.
|
||||
double elapsedSource = masterClock.ElapsedFrameTime != 0 ? masterClock.ElapsedFrameTime : 16;
|
||||
// Clamping is required to ensure that player clocks don't get too far ahead if ProcessFrame is run multiple times.
|
||||
double elapsedSource = masterClock.ElapsedFrameTime != 0 ? masterClock.ElapsedFrameTime : Math.Clamp(masterClock.CurrentTime - CurrentTime, 0, 16);
|
||||
double elapsed = elapsedSource * Rate;
|
||||
|
||||
CurrentTime += elapsed;
|
||||
|
|
Loading…
Reference in New Issue