Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(recording): add timeout to screen capturer stop

Richie McIlroy4a4d6b3e8e2e
diff --git a/crates/recording/src/sources/screen_capture/macos.rs b/crates/recording/src/sources/screen_capture/macos.rs
index 488343e12..099122877 100644
--- a/crates/recording/src/sources/screen_capture/macos.rs
+++ b/crates/recording/src/sources/screen_capture/macos.rs
@@ -729,11 +729,21 @@ impl output_pipeline::VideoSource for VideoSource {
"Capturer stopping after creating {} video frames",
self.video_frame_counter.load(atomic::Ordering::Relaxed)
);
- self.capturer.stop().await?;
+
+ let stop_result =
+ tokio::time::timeout(std::time::Duration::from_secs(5), self.capturer.stop()).await;
self.cancel_token.cancel();
- Ok(())
+ match stop_result {
+ Ok(result) => result,
+ Err(_) => {
+ error!("Screen capturer stop timed out after 5s");
+ Err(anyhow::anyhow!(
+ "Screen capturer stop timed out after 5s — native resources may not be fully released"
+ ))
+ }
+ }
}
.boxed()
}