From 5b3bc4e80edf589f8fd05135283a01905819231f Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 21 Jan 2022 10:50:13 +0100 Subject: [PATCH] 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 --- spa/plugins/alsa/alsa-udev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spa/plugins/alsa/alsa-udev.c b/spa/plugins/alsa/alsa-udev.c index 61ad1af4e..2429d6754 100644 --- a/spa/plugins/alsa/alsa-udev.c +++ b/spa/plugins/alsa/alsa-udev.c @@ -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);