Skip to content

Commit

Permalink
Fix order of events in case audio buffer size changes
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenCWills authored and sezero committed Nov 28, 2024
1 parent 6428cee commit a4ec0b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/audio/SDL_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,6 @@ static int SDLCALL SDL_RunAudio(void *userdata)

/* Loop, filling the audio buffers */
while (!SDL_AtomicGet(&device->shutdown)) {
data_len = device->callbackspec.size;

/* Fill the current buffer with sound */
if (!device->stream && SDL_AtomicGet(&device->enabled)) {
data = current_audio.impl.GetDeviceBuf(device);
Expand All @@ -728,6 +726,8 @@ static int SDLCALL SDL_RunAudio(void *userdata)
data = device->work_buffer;
}

data_len = device->callbackspec.size;

/* !!! FIXME: this should be LockDevice. */
SDL_LockMutex(device->mixer_lock);
if (SDL_AtomicGet(&device->paused)) {
Expand Down

0 comments on commit a4ec0b1

Please sign in to comment.