fix: m0 portal capture — activate the capturer so frames are delivered

The M2 teardown work added an `active` gate to the PipeWire capture callback
(idle by default so reconnects stay cheap, with the stream path calling
set_active(true) on PLAY). The `m0` subcommand was never updated, so its portal
capturer stayed inactive and the callback dropped every frame — `m0 --source
portal` failed with "no PipeWire frame within 10s" on every compositor. Call
set_active(true) before the capture loop.

Validated on headless KWin (Plasma 6.4) via the RemoteDesktop-anchored ScreenCast
session: real desktop frames flow (shm BGRx 1920x1080) and encode to valid H.265.

(Also folds in a rustfmt reflow of the input-test log line.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-09 14:24:09 +00:00
parent 0a79a8209b
commit b64be1dc33
2 changed files with 7 additions and 1 deletions
+4
View File
@@ -59,6 +59,10 @@ pub fn run(opts: Options) -> Result<()> {
} }
}; };
// Activate the capturer so the portal/PipeWire process callback actually delivers frames
// (it gates the per-frame de-pad on `active`; idle by default so reconnects are cheap).
capturer.set_active(true);
// The first frame establishes the authoritative dimensions (the portal's negotiated // The first frame establishes the authoritative dimensions (the portal's negotiated
// size, or the synthetic size) used to configure the encoder. // size, or the synthetic size) used to configure the encoder.
let first = capturer.next_frame().context("capture first frame")?; let first = capturer.next_frame().context("capture first frame")?;
+3 -1
View File
@@ -85,7 +85,9 @@ fn input_test() -> Result<()> {
y, y,
flags: 0, flags: 0,
}; };
tracing::info!("input-test: injecting a mouse square + 'A'/click taps for ~8s (watch wev / focused app)"); tracing::info!(
"input-test: injecting a mouse square + 'A'/click taps for ~8s (watch wev / focused app)"
);
for i in 0..160u32 { for i in 0..160u32 {
let (dx, dy) = match (i / 10) % 4 { let (dx, dy) = match (i / 10) % 4 {
0 => (12, 0), 0 => (12, 0),