Don't hang if IAudioRenderClient_GetBuffer() fails indefinitely

This commit is contained in:
Sam Lantinga 2023-09-18 20:55:28 -07:00
parent a3a5e17282
commit b2b548a1fc
1 changed files with 3 additions and 4 deletions

View File

@ -403,11 +403,10 @@ static Uint8 *WASAPI_GetDeviceBuf(SDL_AudioDevice *device, int *buffer_size)
// get an endpoint buffer from WASAPI.
BYTE *buffer = NULL;
while (RecoverWasapiIfLost(device) && device->hidden->render) {
if (!WasapiFailed(device, IAudioRenderClient_GetBuffer(device->hidden->render, device->sample_frames, &buffer))) {
return (Uint8 *)buffer;
if (RecoverWasapiIfLost(device) && device->hidden->render) {
if (WasapiFailed(device, IAudioRenderClient_GetBuffer(device->hidden->render, device->sample_frames, &buffer))) {
SDL_assert(buffer == NULL);
}
SDL_assert(buffer == NULL);
}
return (Uint8 *)buffer;