audio: Device threads don't increment physical device refcounts.

Otherwise, they risk the device thread joining on itself.

Now we make sure the reference is held at the logical device level until
the physical device is closed, so it can't destroy the device in normal
usage until the thread is joined, etc.
This commit is contained in:
Ryan C. Gordon
2023-10-19 15:44:58 -04:00
parent 594fda4120
commit 76f81797b7
4 changed files with 2 additions and 10 deletions

View File

@@ -181,8 +181,6 @@ 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; });