1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-03 20:06:30 +08:00

Merge pull request #34657 from peppy/audio-hotfix-aaaaaaaaaaaa

Ignore more potentially incorrect data from BASS
This commit is contained in:
Bartłomiej Dach
2025-08-15 11:05:52 +02:00
committed by GitHub
Unverified
9 changed files with 12 additions and 55 deletions
@@ -47,8 +47,6 @@ namespace osu.Game.Rulesets.Mania.Tests
drawableRuleset = (DrawableManiaRuleset)Ruleset.Value.CreateInstance().CreateDrawableRulesetWith(createTestBeatmap())
}
};
drawableRuleset.AllowBackwardsSeeks = true;
});
AddStep("retrieve config bindable", () =>
{
@@ -101,7 +101,6 @@ namespace osu.Game.Tests.NonVisual
public override Container FrameStableComponents { get; }
public override IFrameStableClock FrameStableClock { get; }
internal override bool FrameStablePlayback { get; set; }
public override bool AllowBackwardsSeeks { get; set; }
public override IReadOnlyList<Mod> Mods { get; }
public override double GameplayStartTime { get; }
@@ -131,10 +131,7 @@ namespace osu.Game.Tests.Visual.Gameplay
private void createStabilityContainer(double gameplayStartTime = double.MinValue) => AddStep("create container", () =>
{
mainContainer.Child = new FrameStabilityContainer(gameplayStartTime)
{
AllowBackwardsSeeks = true,
}.WithChild(consumer = new ClockConsumingChild());
mainContainer.Child = new FrameStabilityContainer(gameplayStartTime).WithChild(consumer = new ClockConsumingChild());
});
private void seekManualTo(double time) => AddStep($"seek manual clock to {time}", () => manualClock.CurrentTime = time);
@@ -284,7 +284,6 @@ namespace osu.Game.Tests.Visual.Gameplay
public override Container FrameStableComponents { get; }
public override IFrameStableClock FrameStableClock { get; }
internal override bool FrameStablePlayback { get; set; }
public override bool AllowBackwardsSeeks { get; set; }
public override IReadOnlyList<Mod> Mods { get; }
public override double GameplayStartTime { get; }
@@ -81,17 +81,6 @@ namespace osu.Game.Tests.Visual.Gameplay
AddAssert("pause recorded", () => Player.Score.ScoreInfo.Pauses, () => Has.Count.EqualTo(1));
}
[Test]
public void TestForwardPlaybackGuarantee()
{
hookForwardPlaybackCheck();
AddUntilStep("wait for forward playback", () => Player.GameplayClockContainer.CurrentTime > 1000);
AddStep("seek before gameplay", () => Player.GameplayClockContainer.Seek(-5000));
checkForwardPlayback();
}
[Test]
public void TestPauseWithLargeOffset()
{
@@ -269,7 +269,6 @@ namespace osu.Game.Tests.Visual.Gameplay
drawableRuleset = (TestDrawablePoolingRuleset)ruleset.CreateDrawableRulesetWith(CreateWorkingBeatmap(beatmap).GetPlayableBeatmap(ruleset.RulesetInfo));
drawableRuleset.FrameStablePlayback = true;
drawableRuleset.AllowBackwardsSeeks = true;
drawableRuleset.PoolSize = poolSize;
Child = new Container
-20
View File
@@ -102,19 +102,6 @@ namespace osu.Game.Rulesets.UI
private FrameStabilityContainer frameStabilityContainer;
private DrawableRulesetDependencies dependencies;
private bool allowBackwardsSeeks;
public override bool AllowBackwardsSeeks
{
get => allowBackwardsSeeks;
set
{
allowBackwardsSeeks = value;
if (frameStabilityContainer != null)
frameStabilityContainer.AllowBackwardsSeeks = value;
}
}
private bool frameStablePlayback = true;
internal override bool FrameStablePlayback
@@ -190,7 +177,6 @@ namespace osu.Game.Rulesets.UI
InternalChild = frameStabilityContainer = new FrameStabilityContainer(GameplayStartTime)
{
FrameStablePlayback = FrameStablePlayback,
AllowBackwardsSeeks = AllowBackwardsSeeks,
Children = new Drawable[]
{
FrameStableComponents,
@@ -481,12 +467,6 @@ namespace osu.Game.Rulesets.UI
/// </summary>
internal abstract bool FrameStablePlayback { get; set; }
/// <summary>
/// When a replay is not attached, we usually block any backwards seeks.
/// This will bypass the check. Should only be used for tests.
/// </summary>
public abstract bool AllowBackwardsSeeks { get; set; }
/// <summary>
/// The mods which are to be applied.
/// </summary>
@@ -6,6 +6,7 @@ using System.Diagnostics;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Bindables;
using osu.Framework.Development;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Logging;
@@ -25,7 +26,6 @@ namespace osu.Game.Rulesets.UI
{
public ReplayInputHandler? ReplayInputHandler { get; set; }
public bool AllowBackwardsSeeks { get; set; }
private double? lastBackwardsSeekLogTime;
/// <summary>
@@ -154,17 +154,21 @@ namespace osu.Game.Rulesets.UI
state = PlaybackState.NotValid;
}
// This is a hotfix for https://github.com/ppy/osu/issues/26879 while we figure how the hell time is seeking
// backwards by 11,850 ms for some users during gameplay.
// TODO: replace IsDebugBuild with a framework flag which asserts we are in a test scene, interactively or otherwise.
bool allowReferenceClockSeeks = hasReplayAttached || DebugUtils.IsNUnitRunning || DebugUtils.IsDebugBuild || !FrameStablePlayback;
// This is a hotfix for ongoing bass issues we are trying to resolve (see https://www.un4seen.com/forum/?topic=20482.msg145474#msg145474)
//
// It basically says that "while we're running in frame stable mode, and don't have a replay attached,
// time should never go backwards". If it does, we stop running gameplay until it returns to normal.
if (!hasReplayAttached && FrameStablePlayback && proposedTime > referenceClock.CurrentTime && !AllowBackwardsSeeks)
// In testing this triggers *very* rarely even when set to super low values (10 ms). The cases we're worried about involve multi-second jumps.
// A difference of more than 500 ms seems like a sane number we should never exceed.
if (!allowReferenceClockSeeks && Math.Abs(proposedTime - referenceClock.CurrentTime) > 500)
{
if (lastBackwardsSeekLogTime == null || Math.Abs(Clock.CurrentTime - lastBackwardsSeekLogTime.Value) > 1000)
{
lastBackwardsSeekLogTime = Clock.CurrentTime;
Logger.Log($"Denying backwards seek during gameplay (reference: {referenceClock.CurrentTime:N2} stable: {proposedTime:N2})");
Logger.Log("Ignoring likely invalid time value provided by BASS during gameplay");
Logger.Log($"- provided: {referenceClock.CurrentTime:N2}");
Logger.Log($"- expected: {proposedTime:N2}");
}
state = PlaybackState.NotValid;
-8
View File
@@ -70,14 +70,6 @@ namespace osu.Game.Tests.Visual
AddStep($"Load player for {CreatePlayerRuleset().Description}", LoadPlayer);
AddUntilStep("player loaded", () => Player.IsLoaded && Player.Alpha == 1);
if (AllowBackwardsSeeks)
{
AddStep("allow backwards seeking", () =>
{
Player.DrawableRuleset.AllowBackwardsSeeks = AllowBackwardsSeeks;
});
}
}
protected virtual bool AllowFail => false;