From 6cdc177b9e709356737a96b11e01d7d5e44d78ee Mon Sep 17 00:00:00 2001 From: VallierDev <24893073+VallierDev@users.noreply.github.com> Date: Fri, 16 Oct 2026 11:01:26 +0800 Subject: [PATCH] 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 --- src/video.rs | 2 ++ src/wayland.rs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/video.rs b/src/video.rs index ae41d49..81ee52d 100644 --- a/src/video.rs +++ b/src/video.rs @@ -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 }; diff --git a/src/wayland.rs b/src/wayland.rs index da7c92e..27c83be 100644 --- a/src/wayland.rs +++ b/src/wayland.rs @@ -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); }