Ensure elapsed time is always non-zero when advancing SpectatorPlayerClock

This commit is contained in:
Dean Herbert
2022-08-24 16:33:07 +09:00
parent af56cd0126
commit 5f01f461b3
2 changed files with 11 additions and 2 deletions

View File

@ -77,7 +77,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
{
if (IsRunning)
{
double elapsedSource = masterClock.ElapsedFrameTime;
// 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;
double elapsed = elapsedSource * Rate;
CurrentTime += elapsed;