Skip to content

Commit a4ec0b1

Browse files
StephenCWillssezero
authored andcommitted
Fix order of events in case audio buffer size changes
1 parent 6428cee commit a4ec0b1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/audio/SDL_audio.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,6 @@ static int SDLCALL SDL_RunAudio(void *userdata)
700700

701701
/* Loop, filling the audio buffers */
702702
while (!SDL_AtomicGet(&device->shutdown)) {
703-
data_len = device->callbackspec.size;
704-
705703
/* Fill the current buffer with sound */
706704
if (!device->stream && SDL_AtomicGet(&device->enabled)) {
707705
data = current_audio.impl.GetDeviceBuf(device);
@@ -728,6 +726,8 @@ static int SDLCALL SDL_RunAudio(void *userdata)
728726
data = device->work_buffer;
729727
}
730728

729+
data_len = device->callbackspec.size;
730+
731731
/* !!! FIXME: this should be LockDevice. */
732732
SDL_LockMutex(device->mixer_lock);
733733
if (SDL_AtomicGet(&device->paused)) {

0 commit comments

Comments
 (0)