Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: return Err on audio stream disconnect instead of silent Ok

Louis Beaumontbc11de2ec52d
diff --git a/crates/screenpipe-audio/src/core/run_record_and_transcribe.rs b/crates/screenpipe-audio/src/core/run_record_and_transcribe.rs
index 7d33e0581..ae64309e6 100644
--- a/crates/screenpipe-audio/src/core/run_record_and_transcribe.rs
+++ b/crates/screenpipe-audio/src/core/run_record_and_transcribe.rs
@@ -105,8 +105,13 @@ pub async fn run_record_and_transcribe(
warn!("final flush failed for {}: {}", device_name, e);
}
- info!("stopped recording for {}", device_name);
- Ok(())
+ if audio_stream.is_disconnected.load(Ordering::Relaxed) {
+ info!("stopped recording for {} (disconnected)", device_name);
+ Err(anyhow::anyhow!("device {} disconnected", device_name))
+ } else {
+ info!("stopped recording for {}", device_name);
+ Ok(())
+ }
}
/// Receive one audio chunk from the broadcast channel, handling timeouts and device type logic.