pipewire/spa/plugins
Hans de Goede 584168caab spa: v4l2: call start_monitor() before enum_devices()
This fixes 2 races wrt probing v4l2 devices:

1. Before this change there was a window where a new udev device can get
added between the udev_enumerate_scan_devices() call in enum_devices() and
the udev_monitor_enable_receiving(this->umonitor); call. If this window was
hit then enum_devices() would not see the device and no udev-event for it
would be received either causing the device to not be seen.

Enabling udev event monitoring before calling udev_enumerate_scan_devices()
fixes this. Note that the code is already prepared to deal with getting
multiple add/change events for the same udev device, so hitting the new
race window where PipeWire may receive both an add- or change-event and
also sees + probes the device from enum_devices() is not a problem.

2. Before this change devices added by enum_devices() would not have
inotify monitoring activated right away because notify.fd = -1 at this
time turning start_watching_device() into a no-op.

These devices without inotify monitoring would then have their access
checked by process_device() calling check_access().

Then after all devices have been enumerated start_monitor() would call
start_inotify() which calls start_watching_device() for all devices added
by enum_devices(). This leaves a window where the ACL can change without
there being an inotify watch for it.

Calling start_monitor() before enum_devices() puts start_inotify()
notify before enum_devices() so that the add_device() calls done
by enum_devices() will now successfully call start_watching_device()
closing this window.

PipeWire is somewhat likely to not notify ACL changes because of this
because PipeWire is part of the systemd user default.target, where as
logind only starts applying the ACLs after GNOME has created the seat
for the GNOME session. So on first login we have PipeWire starting
and logind applying the ACLs at the same time, which allows for the ACL
change to hit the small race window where PipeWire is not monitoring
for ACL changes. Fixing this second race should hopefully resolve
issue #3960.

Closes: #3960
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-08-07 22:38:16 +00:00
..
aec spa: aec: webrtc: Fix multichannel processing 2024-06-25 15:34:30 -04:00
alsa alsa-pcm: Lower the frequency of USB gadget rate updates 2024-07-31 12:00:07 -04:00
audioconvert audioconvert: only accept UMP on the control port 2024-07-30 09:38:40 +02:00
audiomixer spa: revert peer_enum_params node event again 2024-06-20 10:22:45 +02:00
audiotestsrc fix compilation some more 2024-06-18 15:41:12 +02:00
avb spa: small cleanups 2024-01-10 15:51:01 +01:00
bluez5 bluez5: Parse 'broadcasting' state 2024-08-01 10:36:58 +00:00
control control: add support for mixing to UMP 2024-07-29 18:15:58 +02:00
ffmpeg spa: use log topics everywhere 2024-03-11 18:45:21 +02:00
jack spa: use log topics everywhere 2024-03-11 18:45:21 +02:00
libcamera spa: libcamera: Increase devices_str[] buffer size 2024-08-06 15:14:27 +02:00
support loop: don't usleep when queue is full 2024-08-06 12:05:11 +02:00
test spa: use log topics everywhere 2024-03-11 18:45:21 +02:00
v4l2 spa: v4l2: call start_monitor() before enum_devices() 2024-08-07 22:38:16 +00:00
videoconvert videoconvert: Enable loading external converter plugins 2024-01-22 13:59:16 +00:00
videotestsrc Port videotestsrc to LoopUtils 2024-07-01 15:28:14 +00:00
volume spa: fix volume plugin compilation 2024-06-18 15:44:26 +02:00
vulkan treewide: fix more -Wformat issues 2024-06-30 19:22:17 +00:00
meson.build meson: fix build with missing libudev-devel 2024-02-06 11:49:40 +01:00