Skip to content

fix(video): list V4L2 cameras once with PipeWire - #4488

Merged
kixelated merged 4 commits into
mainfrom
quest/m1/pipewire-dup-cameras
Sep 29, 2026
Merged

kixelated merged 4 commits into
mainfrom
quest/m1/pipewire-dup-cameras

Conversation

@kixelated

@kixelated kixelated commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Linux camera enumeration lists a UVC webcam twice when PipeWire wraps the V4L2 device.

Approach

Keep a scanned PipeWire node's api.v4l2.path only for device.api=v4l2. Omit that node from the camera list only when V4L2 already enumerated the same path. Native V4L2 enumeration now lists only devices offering YUYV or MJPEG (checked with VIDIOC_ENUM_FMT), so an NV12- or RGB-only device keeps its openable PipeWire entry instead of a native one that can't open. Update the listing docs and remove the completed quest.

Impact

  • Camera listing hides duplicate V4L2-backed PipeWire entries. Identical webcam labels, libcamera devices, inaccessible V4L2 devices and sandbox-only cameras remain distinct or visible.
  • Native V4L2 listing drops capture devices offering neither YUYV nor MJPEG, which open already refused.
  • Public signatures and wire formats are unchanged. Explicit pipewire:<name> opens and default priority selection still use the complete node scan.

Alternatives

Matching labels would hide distinct identical webcams. Hiding every V4L2-backed node would remove cameras in sandboxes where native V4L2 enumeration is empty.

Validation

The scanned-properties regression failed before the filter. just rs test -p moq-video --features pipewire passed 204 tests (5 hardware-dependent tests skipped). This feature's tests run in the existing nightly features job. just check, PipeWire-feature Clippy with warnings denied, quest check (462 documents) and git diff --check all passed.

Follow-ups

None. No physical camera was required for the property-based regression.

(Written by GPT-6, format filter by Claude Opus 5.5)

@kixelated

Copy link
Copy Markdown
Collaborator Author

Completed the quest and removed its file/reference. Enumeration now suppresses only PipeWire V4L2 nodes whose device paths native V4L2 already listed. Other cameras and explicit/default PipeWire selection remain available.

The scanned-properties regression failed before the filter; 203 PipeWire-feature tests pass (5 hardware tests skipped). just check, PipeWire Clippy, quest validation and diff checks pass. No public signature or wire change. No outstanding decisions or follow-ups; recommend /quest-merge after normal review. Left as a draft per the approved background workflow.

(Written by GPT-6)

@kixelated
kixelated marked this pull request as ready for review September 29, 2026 13:21
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 43 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 3b811989-64fa-49d1-8ddc-7b27ea4f60c2

📥 Commits

Reviewing files that changed from the base of the PR and between 15239d6 and 2fadf64.

📒 Files selected for processing (6)
  • doc/lib/rs/moq-video.md
  • quest/m1/README.md
  • quest/m1/pipewire-dup-cameras.md
  • rs/moq-video/src/capture/mod.rs
  • rs/moq-video/src/capture/pipewire/camera.rs
  • rs/moq-video/src/capture/v4l2.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T17:08:31.025946Z 2fadf64 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f4dd3a893c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +78 to +80
!v4l2
.iter()
.any(|camera| node.v4l2_path.as_deref() == Some(camera.id.as_str()))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep PipeWire entries that native V4L2 cannot decode

When a V4L2 capture device exposes only NV12, RGB, or another format outside YUYV/MJPEG, v4l2::cameras still lists it because that function checks only the capture and streaming capability flags, while native open later has no candidate in Source::ALL. This path-only filter then removes the same device's usable PipeWire entry even though the PipeWire backend supports NV12 and RGB, leaving cameras() with only an identifier that cannot be opened. Suppress the PipeWire node only after confirming the native backend can convert at least one of the device's formats.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 43feeed: v4l2::cameras now lists only devices whose VIDIOC_ENUM_FMT includes YUYV or MJPEG, so an NV12- or RGB-only device keeps its PipeWire entry. Covered by only_devices_offering_a_converted_format_are_cameras.

(Written by Claude Opus 5.5)

kixelated and others added 2 commits September 29, 2026 09:54
A device offering neither YUYV nor MJPEG listed an id open refuses and
hid the PipeWire entry for the same path, which could open it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Merging. Changes on top of the original fix:

  • Resolved the Codex P2: native V4L2 enumeration now lists only devices whose VIDIOC_ENUM_FMT offers YUYV or MJPEG, so path dedup keeps the openable PipeWire entry for NV12- or RGB-only devices. Unit test covers the format filter without hardware.
  • Merged latest main. just check, quest check, PipeWire-feature Clippy (-D warnings) and 204 PipeWire-feature tests pass locally.

No API or wire changes. Codex approved 2fadf64.

(Written by Claude Opus 5.5)

@kixelated
kixelated enabled auto-merge (squash) September 29, 2026 17:55
@kixelated
kixelated merged commit 24f622e into main Sep 29, 2026
9 checks passed
@kixelated
kixelated deleted the quest/m1/pipewire-dup-cameras branch September 29, 2026 18:25
This was referenced Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant