Wayland capture: pace from buffer availability; log capture exit

Review follow-ups to f0506bc: a stalled encoder read no longer shortens the
next capture interval, and the capture process exit status is logged
because nothing awaits its task.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
VallierDevandClaude Opus 5.5 committed 2026-10-16 11:01:26 +08:00
1 parent 567662a576
commit 6cdc177b9e
2 files changed
+4 -1

No files matched your search

+2
View File
@@ -447,6 +447,8 @@ async fn read_encoder_with(
} else if let Some(mut capture)=native_capture {
Some(EncoderTask(tokio::spawn(async move {
let status=capture.wait().await.map_err(|e|format!("Wayland capture: {e}"))?;
// Nothing awaits this task; log so the cause survives the generic encoder EOF.
log::warn!("Wayland capture exited: {status}");
Err(format!("Wayland capture exited: {status}"))
})))
} else { None };
+2 -1
View File
@@ -83,8 +83,9 @@ pub fn capture_stdout() -> Result<(),String> {
Ok(())
}).map_err(|e|format!("Capture writer: {e}"))?;
loop {
let start=std::time::Instant::now();
// Time from buffer availability: a slow encoder read must not shorten the next interval.
let Ok(mut frame)=free_rx.recv() else { break };
let start=std::time::Instant::now();
capture(&mut frame)?;
if full_tx.send(frame).is_err() { break; }
if let Some(left)=interval.checked_sub(start.elapsed()) { std::thread::sleep(left); }