Skip to content

Commit

Permalink
Stop decoding a track properly if disposed
Browse files Browse the repository at this point in the history
  • Loading branch information
hwsmm committed Oct 16, 2023
1 parent e463fb3 commit fc7f57f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion osu.Framework/Audio/Track/TrackSDL2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,15 @@ internal void AddToQueue(byte[] audio, object? userdata, AudioDecoder.AudioDecod
player.PutSamplesInStream(audio);

if (done)
{
player.DonePutting();
decodeData = null;
}
}
}

Interlocked.Exchange(ref decodeData, data);
if (!isLoaded)
Interlocked.Exchange(ref decodeData, data);
}

protected override void UpdateState()
Expand Down Expand Up @@ -207,6 +211,8 @@ protected override void Dispose(bool disposing)
isRunning = false;
(Mixer as SDL2AudioMixer)?.StreamFree(this);

decodeData?.Stop();

lock (syncRoot)
player.Dispose();

Expand Down

0 comments on commit fc7f57f

Please sign in to comment.