Skip to content

Fix player submission test intermittent failures due to audio playback discrepancy logic kicking in #26357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko;
using osu.Game.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Screens.Ranking;
using osu.Game.Tests.Beatmaps;

Expand Down Expand Up @@ -359,6 +360,11 @@ public FakeImportingPlayer(bool allowPause = true, bool showResults = true, bool
AllowImportCompletion = new SemaphoreSlim(1);
}

protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart) => new MasterGameplayClockContainer(beatmap, gameplayStart)
{
ShouldValidatePlaybackRate = false,
};

protected override async Task ImportScore(Score score)
{
ScoreImportStarted = true;
Expand Down
9 changes: 9 additions & 0 deletions osu.Game/Screens/Play/MasterGameplayClockContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ public partial class MasterGameplayClockContainer : GameplayClockContainer, IBea
Precision = 0.1,
};

/// <summary>
/// Whether the audio playback rate should be validated.
/// Mostly disabled for tests.
/// </summary>
internal bool ShouldValidatePlaybackRate { get; init; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this missing an = true?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed it is


/// <summary>
/// Whether the audio playback is within acceptable ranges.
/// Will become false if audio playback is not going as expected.
Expand Down Expand Up @@ -223,6 +229,9 @@ protected override void Update()

private void checkPlaybackValidity()
{
if (!ShouldValidatePlaybackRate)
return;

if (GameplayClock.IsRunning)
{
elapsedGameplayClockTime += GameplayClock.ElapsedFrameTime;
Expand Down