From 2e92e94ebb486ed351aae882656f71b1b0053ee2 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 21 Sep 2023 11:31:47 -0700
Subject: [PATCH] Make sure we update device->sample_frames in
SDL_AudioDeviceFormatChangedAlreadyLocked()
WASAPI_GetDeviceBuf() will fail if we don't request the correct buffer size
---
src/audio/SDL_audio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index 9bc1fd42834c..cfd169ad6170 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -1947,7 +1947,7 @@ int SDL_AudioDeviceFormatChangedAlreadyLocked(SDL_AudioDevice *device, const SDL
{
const int orig_work_buffer_size = device->work_buffer_size;
- if (AUDIO_SPECS_EQUAL(device->spec, *newspec)) {
+ if (AUDIO_SPECS_EQUAL(device->spec, *newspec) && new_sample_frames == device->sample_frames) {
return 0; // we're already in that format.
}