pipewire/spa/plugins/v4l2/meson.build
Hans de Goede 2a6ba61264 spa: v4l2: Use systemd-logind to listen for access changes
There is a race between logind applying ACLs to allow the active session
of a locally present user access to devices with a udev uaccess tag
(like /dev/video# nodes) getting applied vs wireplumber/pipewire starting.

Wireplumber/pipewire are part of the (user) default.target, which gets
started as soon as a user logs in and systemd --user is started for that
user, where as logind only starts applying the ACLs after the gnome-shell
associated logind session has been created.

This race may cause pipewire to not see v4l2 video sources at login,
this can be reproduced with these steps:

1. sudo setfacl --remove-all /dev/video*
2. systemctl --user restart pipewire
3. Now wp-ctl status will not show any video devices
   (like if pipewire was started before the udev uaccess ACLs got applied)
4. Do a switch to another (test) user without logging out, e.g. in GNOME
   go to the top right system menu press the power on/off icon and select
   "Switch User..."
5. Switch back to your normal user. Run getfacl /dev/video0 this will show
   your user has access now.
6. wp-ctl status should show the camera now, but it does not.

Fix pipewire not seeing v4l2 sources in this case by making v4l2-udev
monitor systemd-logind session changes and redoing the access() checks
on /dev/video# nodes when the session changes.

Closes: #3539
Closes: #3960
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-09-11 07:26:41 +00:00

19 lines
626 B
Meson

v4l2_sources = ['v4l2.c',
'v4l2-device.c',
'v4l2-source.c']
v4l2_dependencies = [ spa_dep, libinotify_dep ]
if libudev_dep.found()
v4l2_sources += [ 'v4l2-udev.c' ]
v4l2_dependencies += [ libudev_dep ]
if systemd_dep.found()
v4l2_dependencies += [ systemd_dep ]
endif
endif
v4l2lib = shared_library('spa-v4l2',
v4l2_sources,
include_directories : [ configinc ],
dependencies : v4l2_dependencies,
install : true,
install_dir : spa_plugindir / 'v4l2')