From 631934458c0ea8423095f91503405b0a45b79a89 Mon Sep 17 00:00:00 2001 From: dailz Date: Sun, 21 Jun 2026 09:52:27 +0800 Subject: [PATCH] chore: remove obsolete TODO(#19) and dead _fps binding Cleanup pass after the latency investigation concluded: - state_portal.rs: remove TODO(#19) comment block (17 lines). The Option A upgrade path was tentatively documented during the #19 fix, but the user decided to accept current latency behavior. The TODO is now noise. - state.rs:605: remove 'let _fps = self.args.fps as i64;' dead binding left over from #25 time_base change. The variable became unused when PTS formula switched from fps-multiplier to literal 90_000, and was renamed to _fps to silence the warning. Removing it entirely is cleaner. No behavior change. Build clean (0 new warnings). All 96+96+3 tests pass. --- src/state.rs | 1 - src/state_portal.rs | 17 ----------------- 2 files changed, 18 deletions(-) diff --git a/src/state.rs b/src/state.rs index 7d1d1a8..3eaaecc 100644 --- a/src/state.rs +++ b/src/state.rs @@ -602,7 +602,6 @@ impl State { return; } }; - let _fps = self.args.fps as i64; // PTS in 90kHz media-clock ticks (WebRTC encoder time_base = 1/90000). // Must match Portal path's compute_capture_pts unit. See issue #25. let pts = (tv_sec as i64) * 90_000 + (tv_usec as i64) * 90_000 / 1_000_000; diff --git a/src/state_portal.rs b/src/state_portal.rs index e2d410b..26049ce 100644 --- a/src/state_portal.rs +++ b/src/state_portal.rs @@ -176,23 +176,6 @@ impl StatePortal { match self.stage { PortalStage::WaitingForFormat => { - // TODO(#19): Currently the encoder initializes on first PipeWire frame, - // even in WebRTC mode before any client connects. The recurring 60fps - // idle waste (DMA-BUF import + VAAPI scale + clone + channel send) is - // eliminated by the paused gate in handle_pw_frame (see #19 fix). - // However, the one-time SwEncEncode::new_webrtc cost (~50ms, swscale - // context + x264 setup + YUV frame allocation) still occurs at startup. - // - // If this startup cost becomes user-perceptible, upgrade to "Option A": - // 1. Add PortalStage::AwaitingClient - // 2. Keep WebRtcState on main thread during AwaitingClient, pump - // handle_signaling/poll_and_feed from main loop - // 3. On is_connected() == true, initialize encoder and move WebRtcState - // into the WebRTC thread - // 4. Use resolution-aware conservative default bitrate (see #21) - // - // Trigger condition: user reports perceivable latency or CPU spike at - // startup. Until then, Option B is sufficient. tracing::info!( "First DMA-BUF frame: {}x{} format=0x{:08X} stride={} modifier=0x{:X}", frame.width,