1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 16:47:46 +08:00

Do not attempt to stop preview tracks when arriving from a "track completed" sync

This fixes an issue identified with the WASAPI implementation in
https://github.com/ppy/osu-framework/pull/6088. It has no real effect
on current `master`, but fixes a deadlock that occurs with the
aforementioned framework branch when one lets a preview track play out
to the end - at this point all audio will stop and an attempt to perform
any synchronous BASS operation (playing another track, seeking) will
result in a deadlock.

It isn't terribly clear as to why this is happening precisely, but
there does not appear to be any need to stop and seek at that point,
so this feels like a decent workaround even if the actual issue is
upstream (and will unblock pushing out WASAPI support to users).
This commit is contained in:
Bartłomiej Dach 2023-12-25 19:01:06 +01:00
parent dde88bb05e
commit f84b07e71a
No known key found for this signature in database

View File

@ -96,10 +96,13 @@ namespace osu.Game.Audio
hasStarted = false;
Track.Stop();
if (!Track.HasCompleted)
{
Track.Stop();
// Ensure the track is reset immediately on stopping, so the next time it is started it has a correct time value.
Track.Seek(0);
// Ensure the track is reset immediately on stopping, so the next time it is started it has a correct time value.
Track.Seek(0);
}
Stopped?.Invoke();
}