mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-15 14:26:01 +00:00
audio: backends now "find" instead of "obtain" devices by handle.
Every single case of this didn't want the device locked, so just looking it up without having to immediately unlock it afterwards is better here. Often these devices are passed on to other functions that want to lock them themselves anyhow (disconnects, default changes, etc).
This commit is contained in:
@@ -880,13 +880,7 @@ static void ALSA_HotplugIteration(SDL_bool *has_default_output, SDL_bool *has_de
|
||||
for (ALSA_Device *dev = unseen; dev; dev = next) {
|
||||
/*printf("ALSA: removing usb %s device '%s'\n", dev->iscapture ? "capture" : "output", dev->name);*/
|
||||
next = dev->next;
|
||||
|
||||
SDL_AudioDevice *device = SDL_ObtainPhysicalAudioDeviceByHandle(dev->name);
|
||||
if (device) {
|
||||
SDL_UnlockMutex(device->lock); // AudioDeviceDisconnected will relock and verify it's still in the list, but in case this is destroyed, unlock now.
|
||||
SDL_AudioDeviceDisconnected(device);
|
||||
}
|
||||
|
||||
SDL_AudioDeviceDisconnected(SDL_FindPhysicalAudioDeviceByHandle(dev->name));
|
||||
SDL_free(dev->name);
|
||||
SDL_free(dev);
|
||||
}
|
||||
|
Reference in New Issue
Block a user