diff --git a/screenpipe-audio/src/bin/screenpipe-audio.rs b/screenpipe-audio/src/bin/screenpipe-audio.rs index 7c1fcb47e..f23f68c60 100644 --- a/screenpipe-audio/src/bin/screenpipe-audio.rs +++ b/screenpipe-audio/src/bin/screenpipe-audio.rs @@ -27,7 +27,7 @@ struct Args { list_audio_devices: bool, #[clap(long, help = "Disable cloud audio processing")] - cloud_audio_off: bool, + use_cloud_audio: bool, } fn print_devices(devices: &[AudioDevice]) { @@ -77,8 +77,8 @@ async fn main() -> Result<()> { let chunk_duration = Duration::from_secs(5); let output_path = PathBuf::from("output.mp4"); - let cloud_audio = !args.cloud_audio_off; - let (whisper_sender, mut whisper_receiver) = create_whisper_channel(cloud_audio).await?; + let (whisper_sender, mut whisper_receiver) = + create_whisper_channel(args.use_cloud_audio).await?; // Spawn threads for each device let recording_threads: Vec<_> = devices .into_iter() @@ -132,4 +132,4 @@ async fn main() -> Result<()> { } Ok(()) -} \ No newline at end of file +} diff --git a/screenpipe-audio/src/core.rs b/screenpipe-audio/src/core.rs index f0d457d4f..3147fc7e7 100644 --- a/screenpipe-audio/src/core.rs +++ b/screenpipe-audio/src/core.rs @@ -87,12 +87,10 @@ fn get_device_and_config( ) -> Result<(cpal::Device, cpal::SupportedStreamConfig)> { let host = match audio_device.device_type { #[cfg(target_os = "macos")] - DeviceType::Output => cpal::default_host(), + DeviceType::Output => cpal::host_from_id(cpal::HostId::ScreenCaptureKit)?, _ => cpal::default_host(), }; - info!("device: {:?}", audio_device.to_string()); - let audio_device = if audio_device.to_string() == "default" { match audio_device.device_type { DeviceType::Input => host.default_input_device(), @@ -103,6 +101,9 @@ fn get_device_and_config( DeviceType::Input => host.input_devices()?, DeviceType::Output => host.output_devices()?, }; + if cfg!(target_os = "macos") && audio_device.device_type == DeviceType::Output { + devices = host.input_devices()?; + } devices.find(|x| { x.name() @@ -154,16 +155,6 @@ async fn run_ffmpeg( .stdout(Stdio::piped()) .stderr(Stdio::piped()); - // ! tmp hack shouldnt be needed - // Explicitly set the library paths for the FFmpeg command - // if let Ok(ld_library_path) = std::env::var("LD_LIBRARY_PATH") { - // command.env("LD_LIBRARY_PATH", ld_library_path); - // } - // #[cfg(target_os = "macos")] - // if let Ok(dyld_library_path) = std::env::var("DYLD_LIBRARY_PATH") { - // command.env("DYLD_LIBRARY_PATH", dyld_library_path); - // } - debug!("FFmpeg command: {:?}", command); let mut ffmpeg: tokio::process::Child = @@ -326,9 +317,9 @@ pub fn list_audio_devices() -> Result> { { // !HACK macos is suppoed to use special macos feature "display capture" // ! see https://github.com/RustAudio/cpal/pull/894 - let host = cpal::default_host(); - // let host = cpal::host_from_id(cpal::HostId::ScreenCaptureKit)?; - for device in host.output_devices()? { + // let host = cpal::default_host(); + let host = cpal::host_from_id(cpal::HostId::ScreenCaptureKit)?; + for device in host.input_devices()? { if let Ok(name) = device.name() { devices.push(AudioDevice::new(name, DeviceType::Output)); } @@ -359,10 +350,11 @@ pub fn default_output_device() -> Result { { // !HACK macos is suppoed to use special macos feature "display capture" // ! see https://github.com/RustAudio/cpal/pull/894 - let host = cpal::default_host(); - // let host = cpal::host_from_id(cpal::HostId::ScreenCaptureKit)?; + // let host = cpal::default_host(); + let host = cpal::host_from_id(cpal::HostId::ScreenCaptureKit)?; let device = host - .default_output_device() + .default_input_device() + // .default_output_device() .ok_or_else(|| anyhow!("No default input device found"))?; info!("Using display capture device: {}", device.name()?); return Ok(AudioDevice::new(device.name()?, DeviceType::Output)); diff --git a/screenpipe-server/src/server.rs b/screenpipe-server/src/server.rs index 6229e39e2..61fdd4323 100644 --- a/screenpipe-server/src/server.rs +++ b/screenpipe-server/src/server.rs @@ -516,12 +516,12 @@ impl Server { // https://github.com/tokio-rs/axum/blob/main/examples/tracing-aka-logging/src/main.rs TraceLayer::new_for_http() .make_span_with(DefaultMakeSpan::new().include_headers(true)) - .on_request(DefaultOnRequest::new().level(Level::INFO)) - .on_response( - DefaultOnResponse::new() - .level(Level::INFO) - .latency_unit(LatencyUnit::Micros), - ), + // .on_request(DefaultOnRequest::new().level(Level::INFO)) + // .on_response( + // DefaultOnResponse::new() + // .level(Level::INFO) + // .latency_unit(LatencyUnit::Micros), + // ), ) .with_state(app_state);