Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(recording): add timeout to video source stop

Richie McIlroy089322a7479e
diff --git a/crates/recording/src/output_pipeline/core.rs b/crates/recording/src/output_pipeline/core.rs
index 83e1b2120..663fac9e8 100644
--- a/crates/recording/src/output_pipeline/core.rs
+++ b/crates/recording/src/output_pipeline/core.rs
@@ -1193,9 +1193,15 @@ fn spawn_video_encoder<TMutex: VideoMuxer<VideoFrame = TVideo::Frame>, TVideo: V
stop_token.cancelled().await;
- if let Err(e) = video_source.stop().await {
- error!("Video source stop failed: {e:#}");
- };
+ match tokio::time::timeout(Duration::from_secs(5), video_source.stop()).await {
+ Ok(Err(e)) => {
+ error!("Video source stop failed: {e:#}");
+ }
+ Err(_) => {
+ error!("Video source stop timed out after 5s, proceeding with shutdown");
+ }
+ Ok(Ok(())) => {}
+ }
Ok(())
}