ppy / osu

rhythm is just a *click* away!
https://osu.ppy.sh
MIT License
15.32k stars 2.28k forks source link

Shuffling in Song Select plays a few seconds of the previous song #24519

Closed FriendsNone closed 1 year ago

FriendsNone commented 1 year ago

Type

Other

Bug description

When shuffling through in song select (with a 1-2 second pause), the previous song will briefly play on top of the current song.

Screenshots or videos

https://github.com/ppy/osu/assets/4056272/26a41d70-c3d7-4eb0-a6a9-5ae466deed2c

Version

2023.811.0

Logs

database.log input.log legacy-ipc.log network.log performance.log performance-audio.log performance-draw.log performance-input.log performance-update.log runtime.log updater.log

FriendsNone commented 1 year ago

Update: The bug also happens when just selecting a song (by clicking or arrow keys). But I couldn't recreate it consistently, just like when shuffling

bdach commented 1 year ago

I can't reproduce this one at all on my machine... These from performance-audio.log look worrying though:

2023-05-20 03:38:41 [verbose]: | Slow frame on thread "Audio"
2023-05-20 03:38:41 [verbose]: |
2023-05-20 03:38:41 [verbose]: | * Thread time  : 89,713ms
2023-05-20 03:38:41 [verbose]: | * Frame length : 16ms (allowable: 10ms)
2023-05-20 03:38:41 [verbose]: |
2023-05-20 03:38:41 [verbose]: | Call stack was not recorded.

@FriendsNone are you able to capture a video of this with the frame graph showing (ctrl-f11 twice)? Also, are you using multithreaded or single-thread mode?

x3a1n4 commented 1 year ago

I also ran into this exact issue, however I have since restarted my laptop and have not been able to replicate it whatsoever (so no recording). I was on multithreaded mode when the issue happened.

x3a1n4 commented 1 year ago

Update: never mind. Able to replicate it by playing through a song, and then having the song start playing again in the song select screen. It also seems to stop after a while.

https://github.com/ppy/osu/assets/44590809/595216b3-9694-4aa2-9d57-1c8e15396454

Hope this helps!

EDIT: here is my DxDiag.txt file as well. This issue only started on the most recent update

bdach commented 1 year ago

Isn't happening to me with the above reproduction still.

Can I get a dxdiag report from anyone that is experiencing this?

  1. Press Windows+R, type dxdiag in the appearing window and press Enter.
  2. You could be prompted if you'd want Windows to check if the device drivers are signed - there should be no harm in agreeing to that.
  3. In the DirectX Diagnostic Tool window that will appear, click Save All Information... and choose a file to save to.
  4. Attach the saved file to this issue.
Gabixel commented 1 year ago

I had this problem the first time I played with the latest big update (but in a much lighter way, similar to the one in the OP), but I'm not sure if it could have happened before (since I haven't played much). At the moment I can't reproduce it for some arcane reason.

In any case, here's my dxdiag file. (Some small parts are in Italian)

NotGumballer91 commented 1 year ago

I found a good lead so far. It seems to be something to do with the fetching leaderboard?

Here are my steps to reproduce it:

  1. Make sure Global/Country Tab is selected (any online tab)
  2. Load a beatmap
  3. Quickly quit off the map (Auto is easier to quit faster)
  4. Change beatmaps with arrow keys

Video:

https://github.com/ppy/osu/assets/64581009/3b3ca207-2c4f-47d9-9977-27bb8c33ec2a

Logs: performance-draw.log performance-input.log performance-update.log runtime.log updater.log database.log input.log legacy-ipc.log network.log performance.log performance-audio.log

Gabixel commented 1 year ago

Yeah, using online leaderboards seems to cause the issue (I keep the "local" one most of the time, that's why I couldn't replicate it). I can reproduce it now. Loading the beatmap doesn't seem necessary. I just loaded the leaderboard for like half a second (when it's half visible) and then pressed "random" or the arrow keys. I can't tell about "country" without supporter tag, but it works with the global leaderboard so I assume it's the same.

For some reason, the previous song lasts very little for me (I don't know if it's related to the connection speed or other performance factors).

bdach commented 1 year ago

I'm so confused because I'm trying all of these things and getting nothing for it. Maybe once out of thirty-ish tries it maybe sounded like two tracks were playing at once, and I'm not even sure they were now myself.

Probably going to have to start looking blind. Or if someone can do a bisection between https://github.com/ppy/osu/releases/tag/2023.803.0 and current master then that would be much appreciated.

bdach commented 1 year ago

Never mind, this framework-side change is enough to reproduce.

diff --git a/osu.Framework/Graphics/Audio/DrawableTrack.cs b/osu.Framework/Graphics/Audio/DrawableTrack.cs
index 147e812b2..2812dd033 100644
--- a/osu.Framework/Graphics/Audio/DrawableTrack.cs
+++ b/osu.Framework/Graphics/Audio/DrawableTrack.cs
@@ -2,6 +2,7 @@
 // See the LICENCE file in the repository root for full licence text.

 using System;
+using System.Threading;
 using System.Threading.Tasks;
 using osu.Framework.Audio;
 using osu.Framework.Audio.Mixing;
@@ -28,6 +29,13 @@ public DrawableTrack(Track track, bool disposeTrackOnDisposal = true)
             this.track = track;
         }

+        protected override void Dispose(bool isDisposing)
+        {
+            Thread.Sleep(10000);
+
+            base.Dispose(isDisposing);
+        }
+
         public event Action Completed
         {
             add => track.Completed += value;

Regressed by https://github.com/ppy/osu-framework/pull/5956.

FriendsNone commented 1 year ago

Sorry for the silence. It seems that I didn't get any email notifications. On version 2023.812.0 now and the issue still exists.

The issue still occurs when on single-threaded mode. Perhaps worse than multithreaded. The recording now has the frame graph showing.

https://github.com/ppy/osu/assets/4056272/cf760b87-ce5c-4aae-bc0d-9998e025f474

single-threaded.zip

https://github.com/ppy/osu/assets/4056272/7cb3d6af-9a88-43ac-b2c4-2357e3fd94a9

multi-threaded.zip

As for the online leaderboards causing the issue. I couldn't recreate the issue with the internet disabled before launching lazer, and while in song select. But it still happens regardless if you're viewing Global or Local scores