Screen share 4: Linux screen capture backend (spike → production) #151

Closed
opened 2026-11-12 02:06:53 +00:00 by charles · 0 comments
Owner

Files:

  • Create: crates/fluxer-capture/src/desktop.rs (shared with Task 5; this task writes the common part and the Linux cfg), crates/fluxer-capture/tests/linux_real.rs
  • Modify: crates/fluxer-capture/{Cargo.toml,src/lib.rs,README.md}, workspace Cargo.toml (libwebrtc at the version livekit pins, feature glib-main-loop on livekit or libwebrtc as the SDK requires), docs/superpowers/research/2026-11-11-screenshare-spikes.md (§2)
  • Test: linux_real.rs (FLUXER_CAPTURE_TESTS=1 only) plus unit tests of the pacing and conversion glue

Interfaces:

  • Produces: DesktopScreenCapturer: ScreenCapturer (spec §7.1): Wayland → SourceChoice::SystemPicker through DesktopCapturer Generic (portal), capabilities().in_app_picker == false; X11 → Screen/Window lists with 480×270 thumbnails; one capture thread per session pulling capture_frame() at target.fps, BGRA → I420 at the target size (libwebrtc::native::yuv_helper or fluxer-video), Stalled after 3 s without a new frame, Ended when the portal session ends. default_backends() returns it on Linux.

  • Spike part: record in spikes §2 the actual pixel format, frame pacing, behaviour of the portal from a winit app with the GLib thread, what DesktopCapturer::new does without a session (CI container), CPU cost at 1080p30. Fallback (spec §7.1): if the PipeWire path does not work, implement portal.rs with ashpd (ScreenCast) + pipewire video stream behind the same trait, and say so in the PR.

  • Step 1: Write failing tests: unit pacing_holds_target_fps, bgra_frames_become_i420_at_target_size; CI new_without_session_is_an_error_not_a_panic; real (FLUXER_CAPTURE_TESTS=1) wayland_portal_capture_delivers_non_black_frames, x11_lists_screens_and_windows_with_thumbnails, portal_close_reports_ended.

  • Step 2–5: FAIL → implement → PASS (real tests run by the implementer on a Linux desktop; state in the PR which compositor) → commit feat(capture): Linux screen capture.

Depends on: Screen share 3 (#150)

Plan: https://git.forked.io/charles/fluxer-native/src/branch/main/docs/superpowers/plans/2026-11-11-screenshare.md
Spec: https://git.forked.io/charles/fluxer-native/src/branch/main/docs/superpowers/specs/2026-11-11-fluxer-native-screenshare-design.md

**Files:** - Create: `crates/fluxer-capture/src/desktop.rs` (shared with Task 5; this task writes the common part and the Linux `cfg`), `crates/fluxer-capture/tests/linux_real.rs` - Modify: `crates/fluxer-capture/{Cargo.toml,src/lib.rs,README.md}`, workspace `Cargo.toml` (`libwebrtc` at the version `livekit` pins, feature `glib-main-loop` on `livekit` or `libwebrtc` as the SDK requires), `docs/superpowers/research/2026-11-11-screenshare-spikes.md` (§2) - Test: `linux_real.rs` (`FLUXER_CAPTURE_TESTS=1` only) plus unit tests of the pacing and conversion glue **Interfaces:** - Produces: `DesktopScreenCapturer: ScreenCapturer` (spec §7.1): Wayland → `SourceChoice::SystemPicker` through `DesktopCapturer` `Generic` (portal), `capabilities().in_app_picker == false`; X11 → `Screen`/`Window` lists with 480×270 thumbnails; one capture thread per session pulling `capture_frame()` at `target.fps`, BGRA → I420 at the target size (`libwebrtc::native::yuv_helper` or `fluxer-video`), `Stalled` after 3 s without a new frame, `Ended` when the portal session ends. `default_backends()` returns it on Linux. - Spike part: record in *spikes §2* the actual pixel format, frame pacing, behaviour of the portal from a winit app with the GLib thread, what `DesktopCapturer::new` does without a session (CI container), CPU cost at 1080p30. **Fallback** (spec §7.1): if the PipeWire path does not work, implement `portal.rs` with `ashpd` (ScreenCast) + `pipewire` video stream behind the same trait, and say so in the PR. - [ ] **Step 1: Write failing tests**: unit `pacing_holds_target_fps`, `bgra_frames_become_i420_at_target_size`; CI `new_without_session_is_an_error_not_a_panic`; real (`FLUXER_CAPTURE_TESTS=1`) `wayland_portal_capture_delivers_non_black_frames`, `x11_lists_screens_and_windows_with_thumbnails`, `portal_close_reports_ended`. - [ ] **Step 2–5:** FAIL → implement → PASS (real tests run by the implementer on a Linux desktop; state in the PR which compositor) → commit `feat(capture): Linux screen capture`. Depends on: Screen share 3 (#150) Plan: https://git.forked.io/charles/fluxer-native/src/branch/main/docs/superpowers/plans/2026-11-11-screenshare.md Spec: https://git.forked.io/charles/fluxer-native/src/branch/main/docs/superpowers/specs/2026-11-11-fluxer-native-screenshare-design.md
charles added this to the Screen share milestone 2026-11-12 02:06:53 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#151
No description provided.