Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Merge branch 'main' into recording-actor-fixes

Richie McIlroy2fd32a9eb6b7
diff --cc crates/recording/src/sources/microphone.rs
index cf6e2450e,3bcd84022..63f6ff8c6
--- a/crates/recording/src/sources/microphone.rs
+++ b/crates/recording/src/sources/microphone.rs
@@@ -2,12 -2,14 +2,15 @@@ use crate::
feeds::microphone::{self, MicrophoneFeedLock},
output_pipeline::{AudioFrame, AudioSource},
};
-use anyhow::anyhow;
use cap_media_info::AudioInfo;
+ use cpal::SampleFormat;
use futures::{SinkExt, channel::mpsc};
+use kameo::error::SendError;
- use std::sync::Arc;
+ use std::{borrow::Cow, sync::Arc};
+use thiserror::Error;
+ const MICROPHONE_TARGET_CHANNELS: u16 = 1;
+
pub struct Microphone {
info: AudioInfo,
_lock: Arc<MicrophoneFeedLock>,
@@@ -40,10 -37,7 +46,10 @@@ impl AudioSource for Microphone
feed_lock
.ask(microphone::AddSender(tx))
.await
- .map_err(|e| anyhow!("Failed to add camera sender: {e}"))?;
+ .map_err(|err| match err {
- SendError::ActorNotRunning => MicrophoneSourceError::ActorNotRunning.into(),
- other => MicrophoneSourceError::AddSenderFailed(other).into(),
++ SendError::ActorNotRunning(_) => MicrophoneSourceError::ActorNotRunning,
++ other => MicrophoneSourceError::AddSenderFailed(other.map_msg(|_| ())),
+ })?;
tokio::spawn(async move {
while let Ok(frame) = rx.recv_async().await {