Repository navigation
linux-pipewire: list each camera format and size once (#1068 part 1) - #1217
Merged
Merged
Conversation
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
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.
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 twoEnumFormatparams, andcamera_format_list()inplugins/linux-pipewire/camera-portal.c.hadded 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.candtests.d/fragment). It uses the same harness astest_pipewire_camera_renegotiate: a fake camera portal over GTestDBus, a private PipeWire daemon throughtest_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'sformatlist 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.rust/tools/linux-validate/run.sh --repeat 1 --tests test_pipewire_camera_format_dedup):test_pipewire_camera_format_dedup ... ***Failed, withformat "64x48 (1.33:1) - 30 FPS - YUYV422" is listed twice (items 0 and 2). Result: 1 of 277 failed, and no other test failed.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.