Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(recording): keep MicrophoneSamples callback info, optional for synthetic test feeds
Richie McIlroyf68b206934bd
diff --git a/apps/desktop/src-tauri/src/audio_meter.rs b/apps/desktop/src-tauri/src/audio_meter.rsindex db477c78d..7a8e6e6a3 100644--- a/apps/desktop/src-tauri/src/audio_meter.rs+++ b/apps/desktop/src-tauri/src/audio_meter.rs@@ -26,7 +26,9 @@ pub fn spawn_event_emitter(let db = db_fs(floats);- time_window.push(samples.info.timestamp().capture, db);+ if let Some(info) = &samples.info {+ time_window.push(info.timestamp().capture, db);+ }let max = time_window.max();diff --git a/crates/recording/src/feeds/microphone.rs b/crates/recording/src/feeds/microphone.rsindex 92236884f..6977d43ba 100644--- a/crates/recording/src/feeds/microphone.rs+++ b/crates/recording/src/feeds/microphone.rs@@ -3,7 +3,7 @@ use cap_audio::estimate_input_latency;use cap_media_info::{AudioInfo, ffmpeg_sample_format_for};use cap_timestamp::Timestamp;use cpal::{- BufferSize, Device, SampleFormat, StreamError, SupportedStreamConfig,+ BufferSize, Device, InputCallbackInfo, SampleFormat, StreamError, SupportedStreamConfig,SupportedStreamConfigRange,traits::{DeviceTrait, HostTrait, StreamTrait},};@@ -159,6 +159,9 @@ pub struct MicrophoneSamples {pub format: SampleFormat,pub sample_rate: u32,pub channels: u16,+ /// The device callback's info; `None` only for test-utils synthetic+ /// devices.+ pub info: Option<InputCallbackInfo>,pub timestamp: Timestamp,}@@ -1418,6 +1421,7 @@ impl MicrophoneFeed {format: data.sample_format(),sample_rate: effective_sample_rate.sample_rate,channels: callback_channels,+ info: Some(info.clone()),timestamp: timestamp - capture_latency,};@@ -3139,6 +3143,7 @@ pub mod synthetic {format: SampleFormat::F32,sample_rate: self.sample_rate,channels: self.channels,+ info: None,timestamp,}).await;