Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Improve error handling for system audio stop

Richie McIlroyd3e5d9786cc6
diff --git a/crates/recording/src/sources/screen_capture/windows.rs b/crates/recording/src/sources/screen_capture/windows.rs
index a3b3afd5d..633eac79c 100644
--- a/crates/recording/src/sources/screen_capture/windows.rs
+++ b/crates/recording/src/sources/screen_capture/windows.rs
@@ -376,7 +376,14 @@ impl output_pipeline::AudioSource for SystemAudioSource {
}
fn stop(&mut self) -> impl Future<Output = anyhow::Result<()>> {
- let res = self.capturer.pause().map_err(Into::into);
- async { res }
+ let res = self.capturer.pause();
+
+ async move {
+ if let Err(err) = res {
+ warn!("system audio capturer pause failed: {err}");
+ }
+
+ Ok(())
+ }
}
}
diff --git a/crates/recording/src/studio_recording.rs b/crates/recording/src/studio_recording.rs
index c6d2e9fa4..75ef41659 100644
--- a/crates/recording/src/studio_recording.rs
+++ b/crates/recording/src/studio_recording.rs
@@ -23,7 +23,7 @@ use std::{
time::{Duration, Instant, SystemTime, UNIX_EPOCH},
};
use tokio::sync::watch;
-use tracing::{Instrument, debug, error_span, info, trace};
+use tracing::{Instrument, debug, error_span, info, trace, warn};
#[allow(clippy::large_enum_variant)]
enum ActorState {
@@ -311,12 +311,20 @@ impl Pipeline {
cursor.actor.stop();
}
+ let system_audio = match system_audio.transpose() {
+ Ok(value) => value,
+ Err(err) => {
+ warn!("system audio pipeline failed during stop: {err:#}");
+ None
+ }
+ };
+
Ok(FinishedPipeline {
start_time: self.start_time,
screen: screen.context("screen")?,
microphone: microphone.transpose().context("microphone")?,
camera: camera.transpose().context("camera")?,
- system_audio: system_audio.transpose().context("system_audio")?,
+ system_audio,
cursor: self.cursor,
})
}