audio: Fix device refcounting vs ProvidesOwnCallbackThread backends.

This commit is contained in:
Ryan C. Gordon
2023-10-16 20:17:04 -04:00
parent c6f08c2553
commit b733adb503
5 changed files with 13 additions and 4 deletions

View File

@@ -181,6 +181,8 @@ static int EMSCRIPTENAUDIO_OpenDevice(SDL_AudioDevice *device)
return SDL_OutOfMemory();
}
RefPhysicalAudioDevice(device); // CloseDevice will always unref this through SDL_AudioThreadFinalize, even if we failed to start the thread.
// limit to native freq
device->spec.freq = EM_ASM_INT({ return Module['SDL3'].audioContext.sampleRate; });