pipewire/spa/plugins/v4l2/meson.build

20 lines
624 B
Meson
Raw Permalink Normal View History

v4l2_sources = ['v4l2.c',
'v4l2-device.c',
'v4l2-source.c']
v4l2_dependencies = [ spa_dep, libinotify_dep ]
if libudev_dep.found()
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> (cherry picked from commit 2a6ba6126410150d9b11b66f04bbccd48188aa5a)
2024-09-10 11:14:35 +02:00
v4l2_sources += [ 'v4l2-udev.c' ]
v4l2_dependencies += [ libudev_dep ]
if logind_dep.found()
v4l2_dependencies += [ logind_dep ]
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> (cherry picked from commit 2a6ba6126410150d9b11b66f04bbccd48188aa5a)
2024-09-10 11:14:35 +02:00
endif
endif
v4l2lib = shared_library('spa-v4l2',
v4l2_sources,
include_directories : [ configinc ],
dependencies : v4l2_dependencies,
2016-09-26 12:15:52 +02:00
install : true,
install_dir : spa_plugindir / 'v4l2')