From 235a66bfc8a5341d0c40966b3746a97749b1c9a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Thu, 1 Sep 2022 10:39:27 +0200 Subject: audio: list devices for all AOs with hotplug_init Previously we would only call list_devs() on available AOs if an AO *did not* have a hotplug_init() callback or for the first one that *did* have it. This is problematic when multiple fully functional hotplug-capable AOs are available. The second one would not be able to contribute discovered devices. This problem prevents ao_pipewire from introducing full hotplug support with hotplug_init(). --- audio/out/ao.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/audio/out/ao.c b/audio/out/ao.c index 4dddd7dc2b..397af50a78 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -532,10 +532,13 @@ struct ao_device_list *ao_hotplug_get_device_list(struct ao_hotplug *hp, continue; if (ao->driver->hotplug_init) { - if (!hp->ao && ao->driver->hotplug_init(ao) >= 0) - hp->ao = ao; // keep this one - if (hp->ao && hp->ao->driver == d) - get_devices(hp->ao, list); + if (ao->driver->hotplug_init(ao) >= 0) { + get_devices(ao, list); + if (hp->ao) + ao->driver->hotplug_uninit(ao); + else + hp->ao = ao; // keep this one + } } else { get_devices(ao, list); } -- cgit v1.2.3