screenpipe
screenpipe copied to clipboard
adding health_check and auto recovery/restart for macos
name: Audio Stability Fixes about: Submit changes for macOS audio recovery system title: "[AUDIO] Fix macOS audio device recovery" labels: 'bugfix, audio'
Description
Implemented core logic for macOS audio device recovery when devices randomly stop during long sessions (>48h). Addresses silent failures in CoreAudio/ScreenCaptureKit.
Changes
- Added zombie state detection via heartbeat monitoring
- Implemented 3-stage recovery process:
- Soft restart (reinitialize stream)
- Device-level reset (CoreAudio)
- Full pipeline restart (fallback)
- Added recovery metrics tracking
// Key addition to AudioManager
impl AudioManager {
pub async fn hard_reset_device(&self, device_name: &str) -> Result<()> {
self.stop_device(device_name).await?;
// macOS-specific cleanup
#[cfg(target_os = "macos")]
macos_audio::release_device_resources(device_name).await?;
let device = parse_audio_device(device_name)?;
self.start_device(&device).await?;
info!("Hard reset completed for {}", device_name);
Ok(())
}
}
Notes
- Logs available via tracing subscribers
- Metrics exposed via AudioManager::recovery_stats()
/claim https://github.com/mediar-ai/screenpipe/issues/1626
🧪 testing bounty created!
a testing bounty has been created for this PR: view testing issue
testers will be awarded $20 each for providing quality test reports. please check the issue for testing requirements.
does it work? how can you prove it