Skip to content

linux-pipewire: list each camera format and size once (#1068 part 1) - #1217

Merged
zackees merged 3 commits into
masterfrom
fix/1068-pipewire-format-list
Oct 17, 2026
Merged

zackees merged 3 commits into
masterfrom
fix/1068-pipewire-format-list

Conversation

@zackees

@zackees zackees commented Oct 17, 2026

Copy link
Copy Markdown
Member

Refs #1068 (part 1: duplicate entries in the camera format list). Part 2, the "30 FPS" label, stays open on #1068.

Cause

PipeWire's libcamera plugin (spa_libcamera_enum_format) emits, for each pixel format, index 0 = the size closest to 640x480, then every size again. The same (format, size) therefore arrives as two EnumFormat params, and camera_format_list() in plugins/linux-pipewire/camera-portal.c.h added one list item per param, so the Properties dropdown showed the default size twice.

Fix

camera_format_list() skips a param whose video format and size are already listed. The first occurrence is kept, so the default stays at the top. A param is recorded only once it is actually added, so a copy skipped for an unsupported framerate does not hide a later one.

Tests

New cmocka test test_pipewire_camera_format_dedup (test/cmocka/test_pipewire_camera_format_dedup.c and tests.d/ fragment). It uses the same harness as test_pipewire_camera_renegotiate: a fake camera portal over GTestDBus, a private PipeWire daemon through test_pipewire_cursor_hdr.sh, and a stream node that plays the camera. The node advertises libcamera's order: YUY2 64x48, YUY2 32x24, YUY2 64x48. The test fills the source's format list as the Properties window does. It asserts that no item name repeats, that there are exactly 2 items, and that 64x48 comes first. No existing C test or public header is changed.

  • RED 12ca794 (rust/tools/linux-validate/run.sh --repeat 1 --tests test_pipewire_camera_format_dedup): test_pipewire_camera_format_dedup ... ***Failed, with format "64x48 (1.33:1) - 30 FPS - YUYV422" is listed twice (items 0 and 2). Result: 1 of 277 failed, and no other test failed.
  • 0012cee: gersemi formatting of the new CMake fragment only.
  • GREEN dfa8e69 (run.sh --repeat 1 --tests 'test_pipewire_camera_(format_dedup|renegotiate|resolution_restart)'): 277/277 passed in both libobs and libobs-with-rust. The repeat run passed 3/3 in both (format_dedup 0.74 s, renegotiate 4.64 s, resolution_restart 2.07 s).

Tiers: this is a C plugin fix with no Rust port involved, so Tier 1, Tier 3 and Tier 4 do not apply. Tier 2 covers it through the new cmocka test.

…1068)

PipeWire's libcamera plugin emits, per pixel format, the size closest to
640x480 first and then every size, so one (format, size) comes as two
EnumFormat params. The camera source's format list shows it twice.

Refs #1068
PipeWire's libcamera plugin (spa_libcamera_enum_format) emits, per pixel
format, the size closest to 640x480 first and then every size again, so
camera_format_list() added that format and size twice. Skip a param whose
video format and size are already listed; the first one (the default)
stays at the top.

Refs #1068
@zackees
zackees enabled auto-merge October 17, 2026 10:30
@zackees
zackees added this pull request to the merge queue Oct 17, 2026
Merged via the queue into master with commit b272585 Oct 17, 2026
29 checks passed
@zackees
zackees deleted the fix/1068-pipewire-format-list branch October 26, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant