mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 10:22:54 +08:00
Add comprehensive log output to help figure out problematic clocks
This commit is contained in:
parent
4184a5c1ef
commit
cc8b838bd4
@ -38,6 +38,7 @@ namespace osu.Game.Beatmaps
|
|||||||
private IDisposable? beatmapOffsetSubscription;
|
private IDisposable? beatmapOffsetSubscription;
|
||||||
|
|
||||||
private readonly DecouplingFramedClock decoupledTrack;
|
private readonly DecouplingFramedClock decoupledTrack;
|
||||||
|
private readonly InterpolatingFramedClock interpolatedTrack;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuConfigManager config { get; set; } = null!;
|
private OsuConfigManager config { get; set; } = null!;
|
||||||
@ -58,7 +59,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
// An interpolating clock is used to ensure precise time values even when the host audio subsystem is not reporting
|
// An interpolating clock is used to ensure precise time values even when the host audio subsystem is not reporting
|
||||||
// high precision times (on windows there's generally only 5-10ms reporting intervals, as an example).
|
// high precision times (on windows there's generally only 5-10ms reporting intervals, as an example).
|
||||||
var interpolatedTrack = new InterpolatingFramedClock(decoupledTrack);
|
interpolatedTrack = new InterpolatingFramedClock(decoupledTrack);
|
||||||
|
|
||||||
if (applyOffsets)
|
if (applyOffsets)
|
||||||
{
|
{
|
||||||
@ -190,5 +191,28 @@ namespace osu.Game.Beatmaps
|
|||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
beatmapOffsetSubscription?.Dispose();
|
beatmapOffsetSubscription?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetSnapshot()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
$"originalSource: {output(Source)}\n" +
|
||||||
|
$"userGlobalOffsetClock: {output(userGlobalOffsetClock)}\n" +
|
||||||
|
$"platformOffsetClock: {output(platformOffsetClock)}\n" +
|
||||||
|
$"userBeatmapOffsetClock: {output(userBeatmapOffsetClock)}\n" +
|
||||||
|
$"interpolatedTrack: {output(interpolatedTrack)}\n" +
|
||||||
|
$"decoupledTrack: {output(decoupledTrack)}\n" +
|
||||||
|
$"finalClockSource: {output(finalClockSource)}\n";
|
||||||
|
|
||||||
|
string output(IClock? clock)
|
||||||
|
{
|
||||||
|
if (clock == null)
|
||||||
|
return "null";
|
||||||
|
|
||||||
|
if (clock is IFrameBasedClock framed)
|
||||||
|
return $"current: {clock.CurrentTime:N2} running: {clock.IsRunning} rate: {clock.Rate} elapsed: {framed.ElapsedFrameTime:N2}";
|
||||||
|
|
||||||
|
return $"current: {clock.CurrentTime:N2} running: {clock.IsRunning} rate: {clock.Rate}";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,16 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Input.Handlers;
|
using osu.Game.Input.Handlers;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
@ -161,6 +164,10 @@ namespace osu.Game.Rulesets.UI
|
|||||||
if (!hasReplayAttached && FrameStablePlayback && proposedTime > referenceClock.CurrentTime && !AllowBackwardsSeeks)
|
if (!hasReplayAttached && FrameStablePlayback && proposedTime > referenceClock.CurrentTime && !AllowBackwardsSeeks)
|
||||||
{
|
{
|
||||||
Logger.Log($"Denying backwards seek during gameplay (reference: {referenceClock.CurrentTime:N2} stable: {proposedTime:N2})");
|
Logger.Log($"Denying backwards seek during gameplay (reference: {referenceClock.CurrentTime:N2} stable: {proposedTime:N2})");
|
||||||
|
|
||||||
|
if (parentGameplayClock is GameplayClockContainer gcc)
|
||||||
|
Logger.Log($"{gcc.ChildrenOfType<FramedBeatmapClock>().Single().GetSnapshot()}");
|
||||||
|
|
||||||
state = PlaybackState.NotValid;
|
state = PlaybackState.NotValid;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user