Repository navigation
linux-pipewire: Keep the Properties window when a camera control changes - #829
Merged
Merged
Conversation
zackees
approved these changes
Oct 15, 2026
Dragging a camera control slider (Brightness, Contrast, ...) in the Properties window of the "Video Capture Device (PipeWire)" source drops the handle after one step, and the mouse wheel over the focused slider moves it by one step only. Every control's modified callback, control_changed() in camera-portal.c, returns true, which tells the Properties window to rebuild all its widgets: the first value change of a drag destroys the slider that holds the mouse, and focus moves to the rebuilt spin box, so the slider ignores further wheel events. test_pipewire_camera_control_refresh runs the real camera portal against a fake org.freedesktop.portal.Camera on a private D-Bus bus (GTestDBus) and a private PipeWire daemon (test_pipewire_cursor_hdr.sh). A stream node in the test plays a camera with one control, Brightness 0-255, published as PropInfo and Props params like PipeWire's V4L2 node does, and records the Props the source sets on it. The test moves the slider the way the Properties window does for each step of a drag (obs_property_modified() with the new value). control_change_reaches_the_camera passes (guard: the camera receives brightness 100). control_change_does_not_rebuild_properties fails: 8 of 8 changes ask for a rebuild. Needs an X display for obs_startup(), dbus-daemon and pipewire; skips without them. Refs obs-rust#827. Co-Authored-By: Claude Opus 5.5 <[email protected]>
control_changed(), the modified callback of every camera control of the "Video Capture Device (PipeWire)" source, returned true. That tells the Properties window to rebuild all its widgets. During a drag, the first value change destroyed the slider that held the mouse, so the handle dropped after one step. Focus then went to the rebuilt spin box, and the slider ignores the mouse wheel unless it has focus, so the wheel also moved it by one step only. A new control value changes nothing in the properties, so the callback now returns false. It also set the node's Props from the UI thread without the PipeWire loop lock, while the PipeWire thread adds and removes devices and their node proxies. PipeWire warned "impl_ext_end_proxy called from wrong context" on every change. It now looks up the device and sets the Props with the loop locked, like the other UI-thread paths in this plugin. The PipeWire thread never waits for the UI thread (property reloads are queued to it), so this cannot deadlock. test_pipewire_camera_control_refresh: 2 of 2 pass. The warning is gone. Fixes obs-rust#827. Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=e3f864d87d62476e8180c8715735e0c8845be84f secs=1576 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run Ci-Attestation: {"at":1792080999,"gate":"rust/all/fmt","host":"linux-x86_64","key":"449bc1cfa2feb39ffb194d118d092db65759befb63090ca61fd623454617ab06","lane":"lint","parents":["785cfb00ae5780652a64728141c59b4608de8464"],"secs":61,"stamp":"e02b8deace7d4d792ff95e1ff670e8fe","tree":"e3f864d87d62476e8180c8715735e0c8845be84f","v":1,"via":"run"} Ci-Attestation: {"at":1792080999,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"449bc1cfa2feb39ffb194d118d092db65759befb63090ca61fd623454617ab06","lane":"lint","parents":["785cfb00ae5780652a64728141c59b4608de8464"],"secs":61,"stamp":"417b68b7b45629850f8f1ea937113785","tree":"e3f864d87d62476e8180c8715735e0c8845be84f","v":1,"via":"run"} Ci-Attestation: {"at":1792080999,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"22bca62d0a0ba259f0884c1ceb26a952a8a8e795b1459542dd0249a64684f255","lane":"rust-test","parents":["785cfb00ae5780652a64728141c59b4608de8464"],"secs":129,"stamp":"9b64d219ce8b9d8402c465140a9cf97d","tree":"e3f864d87d62476e8180c8715735e0c8845be84f","v":1,"via":"run"} Ci-Attestation: {"at":1792080999,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"99be3df63a55f11e3866c11014ea517c71e830a36d62ab3790b1f0cfbdc3b589","lane":"cross","parents":["785cfb00ae5780652a64728141c59b4608de8464"],"secs":118,"stamp":"727c1bda4f332cc5c55b37606a18c242","tree":"e3f864d87d62476e8180c8715735e0c8845be84f","v":1,"via":"run"} Ci-Attestation: {"at":1792080999,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"99be3df63a55f11e3866c11014ea517c71e830a36d62ab3790b1f0cfbdc3b589","lane":"cross","parents":["785cfb00ae5780652a64728141c59b4608de8464"],"secs":118,"stamp":"82148c0c461161a42f1273fac84fc9de","tree":"e3f864d87d62476e8180c8715735e0c8845be84f","v":1,"via":"run"} Ci-Attestation: {"at":1792080999,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"99be3df63a55f11e3866c11014ea517c71e830a36d62ab3790b1f0cfbdc3b589","lane":"cross","parents":["785cfb00ae5780652a64728141c59b4608de8464"],"secs":118,"stamp":"96b72a95fb2236ce4563e9ad689cbff4","tree":"e3f864d87d62476e8180c8715735e0c8845be84f","v":1,"via":"run"} Ci-Attestation: {"at":1792080999,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"99be3df63a55f11e3866c11014ea517c71e830a36d62ab3790b1f0cfbdc3b589","lane":"cross","parents":["785cfb00ae5780652a64728141c59b4608de8464"],"secs":118,"stamp":"3326f8fbe000f3763094bef1177b62ed","tree":"e3f864d87d62476e8180c8715735e0c8845be84f","v":1,"via":"run"} Ci-Attestation: {"at":1792080999,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"99be3df63a55f11e3866c11014ea517c71e830a36d62ab3790b1f0cfbdc3b589","lane":"cross","parents":["785cfb00ae5780652a64728141c59b4608de8464"],"secs":118,"stamp":"9eb973496cb91b1a0456489217603d5f","tree":"e3f864d87d62476e8180c8715735e0c8845be84f","v":1,"via":"run"} Ci-Attestation: {"at":1792080999,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"99be3df63a55f11e3866c11014ea517c71e830a36d62ab3790b1f0cfbdc3b589","lane":"cross","parents":["785cfb00ae5780652a64728141c59b4608de8464"],"secs":118,"stamp":"cb2b94d669ba84bbbf87ec1bc9fe2254","tree":"e3f864d87d62476e8180c8715735e0c8845be84f","v":1,"via":"run"} Ci-Attestation: {"at":1792080999,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"5a35aadfc5cdb4f13376360e70e446517e006d2af19653deee104b7c66d0059f","lane":"tier2-linux","parents":["785cfb00ae5780652a64728141c59b4608de8464"],"secs":1268,"stamp":"9ff7b973d5dee3c75aa994b642c3478a","tree":"e3f864d87d62476e8180c8715735e0c8845be84f","v":1,"via":"run"}
Member
|
Rebased onto master, set
|
zackees
force-pushed
the
fix/pw-camera-control-refresh
branch
from
October 15, 2026 16:16
d72ae26 to
e47216b
Compare
This was referenced Oct 15, 2026
chriscoveries
pushed a commit
to chriscoveries/obsrust-fork
that referenced
this pull request
Oct 16, 2026
…mode is on (obs-rust#1054) * test/cmocka: Add failing tests for PipeWire camera automatic controls In the Properties window of the "Video Capture Device (PipeWire)" source, ticking "Focus, Automatic Continuous" leaves "Focus, Absolute" enabled: the slider drags, and the camera ignores it. The same for Exposure Time, Absolute in Auto Mode, White Balance Temperature with White Balance, Automatic on, and Hue with Hue, Automatic on. The V4L2 driver flags these controls inactive (V4L2_CTRL_FLAG_INACTIVE), and the V4L2 source greys them out since obs-rust#895, but PipeWire's V4L2 node does not pass the flag on: its PropInfo params only carry each control's id, name and range. Menu controls (Auto Exposure, Power Line Frequency) are missing from the window altogether: the node publishes a menu as a plain Int with labels, and the source only reads a choice, so Auto Exposure cannot be switched to Manual Mode from OBS. test_pipewire_camera_control_refresh now plays two cameras the way PipeWire's V4L2 node publishes them (the same prop ids, menus, and the "device.api" and "object.path" node properties): - the "UHD Camera" of obs-rust#827, with the control list its driver reports (uvcvideo, kernel 7.2.9): Focus, Absolute comes before Focus, Automatic Continuous, Auto Exposure starts in Auto Mode, and Iris, Absolute has a step of 0; - a webcam with White Balance, Automatic (listed before its controls) and Hue, Automatic (listed after Hue), in Aperture Priority Mode. Brightness of the existing cases now uses the UHD Camera's range (0-14). Cases. Guards that pass: - control_change_reaches_the_camera, control_change_does_not_rebuild_ properties (obs-rust#829): unchanged apart from the range. - saved_manual_modes_enable_the_controls_on_load: saved settings with the automatic modes off leave the manual controls enabled. Failing: - manual_controls_are_disabled_on_load: Focus, Absolute and Exposure Time, Absolute of the UHD Camera, and the webcam's white balance, hue, exposure and focus controls are enabled while their automatic modes are on. Iris, Absolute and the controls after it must stay enabled. - toggling_autofocus_disables_and_enables_the_focus: unticking and ticking the checkbox, three times, asks for no rebuild and changes nothing. - switching_auto_exposure_disables_and_enables_the_exposure: no Auto Exposure list to switch. - toggling_white_balance_and_hue_automatic: the same for White Balance, Automatic and Hue, Automatic. - menu_controls_are_shown: Auto Exposure and Power Line Frequency are missing. The node's device path, name and fd must not show up. - moving_a_manual_control_keeps_the_properties: drags of Focus, Absolute with autofocus off and of Iris, Absolute pass; moving the overridden Focus, Absolute (from a script) sends it to the camera 8 of 8 times. 6 of 9 fail, in both lanes. Refs obs-rust#827. Co-Authored-By: Claude Opus 5.5 <[email protected]> * linux-pipewire: Disable manual camera controls while their automatic mode is on With "Focus, Automatic Continuous" ticked in the Properties window of the "Video Capture Device (PipeWire)" source, "Focus, Absolute" stayed enabled: the slider dragged, and the camera ignored it (uvcvideo flags the control inactive and refuses it with EACCES). The same for Exposure Time, Absolute outside Manual Mode, White Balance Temperature, Red and Blue Balance with White Balance, Automatic on, and Hue with Hue, Automatic on. obs-rust#895 greys these out in the V4L2 source from the driver's V4L2_CTRL_FLAG_INACTIVE, but PipeWire's V4L2 node does not pass that flag on. For a V4L2 camera node ("device.api" v4l2, or an "object.path" starting with "v4l2:"), the source now knows the automatic/manual pairs the V4L2 spec defines, as uvcvideo implements them, by V4L2 control id: the node gives a control the prop id SPA_PROP_START_CUSTOM + its V4L2 id, or SPA_PROP_hue / SPA_PROP_exposure. A manual control is shown disabled while its automatic control, as the window shows it, is not in its manual mode (0, or Manual Mode for Auto Exposure), whatever the order the camera lists them in. When the window opens, and after each change, the states are worked out again; the window is rebuilt only when one of them changed, so dragging a slider still never rebuilds it (obs-rust#829). An overridden manual control is not sent to the camera; it keeps its value. Menu controls are shown again: the node publishes a menu (Auto Exposure, Power Line Frequency) as a plain Int with labels, not as a choice, so the source skipped it, and Auto Exposure could not be set to Manual Mode from OBS. A plain Int with labels is now a list. The node's other plain values (the device's path, name and fd) are still not shown. test_pipewire_camera_control_refresh: 9 of 9 pass, in both lanes. Refs obs-rust#827. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #827
What and why
Camera control sliders (Brightness, Contrast, ...) in the Properties window of the "Video Capture Device (PipeWire)" source can be dragged again. The mouse wheel over a focused slider moves it again too.
control_changed()inplugins/linux-pipewire/camera-portal.cis the modified callback of every camera control. It always returnedtrue, which tellsOBSPropertiesViewto rebuild all its widgets (properties-view.cpp,WidgetInfo::ControlChangedqueuesRefreshProperties()).SliderIgnoreScrollignores the wheel unless it has focus, so the wheel also moved the slider by one step only.falseis safe: a new control value changes nothing in the properties. The rebuild only re-read the same PropInfo list, so the callback now returnsfalse.control_changed()also looked up the device and calledpw_node_set_param()on the UI thread without the PipeWire loop lock, while the PipeWire thread adds and removes devices and their node proxies. PipeWire printedimpl_ext_end_proxy called from wrong context, check thread and lockingon every change. The lookup and the call now run underobs_pipewire_lock(), like the plugin's other UI-thread paths (obs_pipewire_stream_set_framerate(),pw_portal_connection_free()).obs_source_update_properties(), reaches the Properties and Filters windows as a queuedReloadProperties().return truecame from upstream (obsproject/obs-studio, "linux-pipewire: Handle property changes", 2022), not from a change in this fork.VIDIOC_S_CTRLfails, so it is not affected. The reporter's device, "Laptop Webcam Module (2nd Gen) (V4L2)", is PipeWire's node for a V4L2 webcam, shown by the PipeWire source.Reproduced in release v0.1.0-beta.20261014 (AppImage, headless). Setup:
dbus-run-session, private PipeWire daemon and a fake camera portal;On the release, every change logged
obs_property_modified(Brightness) -> true(logged by an LD_PRELOAD shim) and thewrong contextwarning. On this branch:false, and no warning.RED → GREEN
test/cmocka: Add a failing test for PipeWire camera control sliders.test_pipewire_camera_control_refreshruns the real camera portal against a fakeorg.freedesktop.portal.Cameraon a private D-Bus bus (GTestDBus) and a private PipeWire daemon (test_pipewire_cursor_hdr.sh), liketest_pipewire_camera_renegotiate.obs_property_modified()with the new value.control_change_does_not_rebuild_properties("8 of 8 Brightness changes asked to rebuild the Properties window").control_change_reaches_the_camera(guard: the camera receives brightness 100) passes.ENABLE_RUST_LIBOBSOFF and ON, and nowrong contextwarning.test_pipewire_camera_*tests (nv12,registry_race,renegotiate,unload,unplug) pass in both lanes.libobs-openglmasked, TMPDIR unset): 248/248 in both lanes. Every PipeWire/PulseAudio test ran; the only skipped case wasopen_crashes_without_obs_core(intest_audio_ioandtest_video_io), as on master here. WithDISPLAYunset, the new test's cases skip.ci/test_registration.pyandci/test_cmocka_sanitize.pyclean.Checklist
master-W..., ratchets): noneAI note: Claude Code (Claude Opus 5.5) wrote the code, the test, the commit messages and this text under the submitter's direction, and ran the tests above on the submitter's machines.
🤖 Generated with Claude Code