alsa: first start monitor then enumerate devices

So that we can catch the SOUND_INITIALIZED update between enumerating
devices and starting the monitor.This fixes a races in detecting devices.

Thanks to Matthias Fend for finding this.

Fixes #2046
This commit is contained in:
Wim Taymans 2022-01-21 10:50:13 +01:00
parent cec9347864
commit 5b3bc4e80e

View file

@ -687,10 +687,10 @@ impl_device_add_listener(void *object, struct spa_hook *listener,
emit_device_info(this, true);
if ((res = enum_devices(this)) < 0)
if ((res = start_monitor(this)) < 0)
return res;
if ((res = start_monitor(this)) < 0)
if ((res = enum_devices(this)) < 0)
return res;
spa_hook_list_join(&this->hooks, &save);