mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-08 19:06:26 +00:00
fix deadlock on close device
James Zipperer snd_pcm_drain doesn't always drain when you unplug a usb device. Use snd_pcm_drop instead
This commit is contained in:
@@ -725,13 +725,15 @@ SDL_RunAudio(void *devicep)
|
||||
}
|
||||
|
||||
/* !!! FIXME: this should be LockDevice. */
|
||||
SDL_LockMutex(device->mixer_lock);
|
||||
if (SDL_AtomicGet(&device->paused)) {
|
||||
SDL_memset(stream, silence, stream_len);
|
||||
} else {
|
||||
(*callback) (udata, stream, stream_len);
|
||||
if ( SDL_AtomicGet(&device->enabled) ) {
|
||||
SDL_LockMutex(device->mixer_lock);
|
||||
if (SDL_AtomicGet(&device->paused)) {
|
||||
SDL_memset(stream, silence, stream_len);
|
||||
} else {
|
||||
(*callback) (udata, stream, stream_len);
|
||||
}
|
||||
SDL_UnlockMutex(device->mixer_lock);
|
||||
}
|
||||
SDL_UnlockMutex(device->mixer_lock);
|
||||
|
||||
/* Convert the audio if necessary */
|
||||
if (device->convert.needed && SDL_AtomicGet(&device->enabled)) {
|
||||
|
Reference in New Issue
Block a user