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: --disable-audio still triggers audio model download

Louis Beaumont6d9ebec6be84
diff --git a/crates/screenpipe-audio/src/audio_manager/builder.rs b/crates/screenpipe-audio/src/audio_manager/builder.rs
index f7bcbf5e8..72ba4308d 100644
--- a/crates/screenpipe-audio/src/audio_manager/builder.rs
+++ b/crates/screenpipe-audio/src/audio_manager/builder.rs
@@ -72,6 +72,8 @@ pub struct AudioManagerOptions {
pub batch_max_duration_secs: Option<u64>,
/// Channel capacities for recording and transcription queues.
pub channel_config: ChannelConfig,
+ /// Disable all audio functionality (no device polling, no model downloads)
+ pub is_disabled: bool,
}
impl Default for AudioManagerOptions {
@@ -101,6 +103,7 @@ impl Default for AudioManagerOptions {
vocabulary: vec![],
batch_max_duration_secs: None,
channel_config: ChannelConfig::default(),
+ is_disabled: false,
}
}
}
@@ -217,7 +220,7 @@ impl AudioManagerBuilder {
self.validate_options()?;
let options = &mut self.options;
- if options.enabled_devices.is_empty() {
+ if !options.is_disabled && options.enabled_devices.is_empty() {
// Gracefully collect available devices — don't crash if input or output is missing
// (e.g., Mac Mini with no microphone, headless server with no audio hardware)
let mut devices = Vec::new();
@@ -238,6 +241,11 @@ impl AudioManagerBuilder {
AudioManager::new(options.clone(), db).await
}
+ pub fn is_disabled(mut self, is_disabled: bool) -> Self {
+ self.options.is_disabled = is_disabled;
+ self
+ }
+
pub fn output_path(mut self, output_path: PathBuf) -> Self {
self.options.output_path = Some(output_path);
self
diff --git a/crates/screenpipe-audio/src/audio_manager/manager.rs b/crates/screenpipe-audio/src/audio_manager/manager.rs
index 06949637c..57cbfd47e 100644
--- a/crates/screenpipe-audio/src/audio_manager/manager.rs
+++ b/crates/screenpipe-audio/src/audio_manager/manager.rs
@@ -109,17 +109,21 @@ pub struct CentralHandlerRestartResult {
impl AudioManager {
pub async fn new(options: AudioManagerOptions, db: Arc<DatabaseManager>) -> Result<Self> {
let device_manager = DeviceManager::new().await?;
- let segmentation_manager = Arc::new(SegmentationManager::new().await?);
+ let segmentation_manager = Arc::new(SegmentationManager::new(options.is_disabled).await?);
let status = RwLock::new(AudioManagerStatus::Stopped);
- let vad_engine: Arc<Mutex<Box<dyn VadEngine + Send>>> = match options.vad_engine {
- VadEngineEnum::Silero => match SileroVad::new().await {
- Ok(vad) => Arc::new(Mutex::new(Box::new(vad))),
- Err(e) => {
- warn!("silero vad unavailable, falling back to webrtc: {}", e);
- Arc::new(Mutex::new(Box::new(WebRtcVad::new())))
- }
- },
- VadEngineEnum::WebRtc => Arc::new(Mutex::new(Box::new(WebRtcVad::new()))),
+ let vad_engine: Arc<Mutex<Box<dyn VadEngine + Send>>> = if options.is_disabled {
+ Arc::new(Mutex::new(Box::new(WebRtcVad::new())))
+ } else {
+ match options.vad_engine {
+ VadEngineEnum::Silero => match SileroVad::new().await {
+ Ok(vad) => Arc::new(Mutex::new(Box::new(vad))),
+ Err(e) => {
+ warn!("silero vad unavailable, falling back to webrtc: {}", e);
+ Arc::new(Mutex::new(Box::new(WebRtcVad::new())))
+ }
+ },
+ VadEngineEnum::WebRtc => Arc::new(Mutex::new(Box::new(WebRtcVad::new()))),
+ }
};
let channel_config = &options.channel_config;
diff --git a/crates/screenpipe-audio/src/segmentation/segmentation_manager.rs b/crates/screenpipe-audio/src/segmentation/segmentation_manager.rs
index 58c1f9077..3eb54aecd 100644
--- a/crates/screenpipe-audio/src/segmentation/segmentation_manager.rs
+++ b/crates/screenpipe-audio/src/segmentation/segmentation_manager.rs
@@ -25,7 +25,16 @@ pub struct SegmentationManager {
}
impl SegmentationManager {
- pub async fn new() -> Result<Self> {
+ pub async fn new(disabled: bool) -> Result<Self> {
+ if disabled {
+ return Ok(Self {
+ embedding_manager: Arc::new(StdMutex::new(EmbeddingManager::new(100))),
+ embedding_extractor: AsyncMutex::new(None),
+ embedding_model_path: AsyncMutex::new(None),
+ segmentation_model_path: AsyncMutex::new(None),
+ });
+ }
+
let embedding_model_path = match get_or_download_model(PyannoteModel::Embedding).await {
Ok(path) => Some(path),
Err(e) => {
diff --git a/crates/screenpipe-engine/src/recording_config.rs b/crates/screenpipe-engine/src/recording_config.rs
index 04d54e6bb..30b678cb4 100644
--- a/crates/screenpipe-engine/src/recording_config.rs
+++ b/crates/screenpipe-engine/src/recording_config.rs
@@ -221,6 +221,7 @@ impl RecordingConfig {
audio_devices: Vec<String>,
) -> AudioManagerBuilder {
AudioManagerBuilder::new()
+ .is_disabled(self.disable_audio)
.audio_chunk_duration(Duration::from_secs(self.audio_chunk_duration))
.vad_engine(VadEngineEnum::Silero)
.languages(self.languages.clone())