fix(portal): compositor stall detection + filler frames + PipeWire state logging
P0: Detect compositor frame delivery stalls (>100ms no frames) and log
stall/resume events with duration. Rate-limited to 1 warn/sec.
P1: Insert duplicate raw CpuNv12Frame filler during stalls at target fps.
Keeps WebRTC stream smooth (sent_fps 20-40 instead of 3-5 during
compositor pauses). Stops after 2s max stale. WebRTC mode only.
P2: Replace silent _ => {} in PipeWire state_changed callback with
explicit Paused/Streaming/Connecting log messages.
P4: Add PwCtrlEvent::FormatChanged for mid-stream dimension changes.
param_changed detects resolution renegotiation (skips first call).
Logs warning in poll_and_encode; full encoder reinit deferred.
Verified: cargo check 0 errors, 70/70 tests, release build, --stats live.
This commit is contained in:
@@ -66,6 +66,7 @@ fn receive_first_frame(cap: &CapPortal) -> Result<wl_webrtc::cap_portal::PwDmaBu
|
||||
if let Ok(ctrl) = cap.event_receiver().try_recv() {
|
||||
match ctrl {
|
||||
PwCtrlEvent::StreamEnded => bail!("PipeWire stream ended before first frame"),
|
||||
PwCtrlEvent::FormatChanged { .. } => {}
|
||||
PwCtrlEvent::Error(e) => bail!("PipeWire error: {e}"),
|
||||
}
|
||||
}
|
||||
@@ -328,6 +329,7 @@ fn main() -> Result<()> {
|
||||
eprintln!("PipeWire error after {} frames: {}", frames_encoded, e);
|
||||
break;
|
||||
}
|
||||
PwCtrlEvent::FormatChanged { .. } => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user