Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix: retain mixer input gaps below the buffering timeout
Richie McIlroy02b9dd1b27df
diff --git a/crates/recording/src/sources/audio_mixer.rs b/crates/recording/src/sources/audio_mixer.rsindex 32ff5b7ca..23727c258 100644--- a/crates/recording/src/sources/audio_mixer.rs+++ b/crates/recording/src/sources/audio_mixer.rs@@ -553,10 +553,11 @@ impl AudioMixer {0};- let remap =- source- .clock_state- .remap(&self.master_clock, raw_timestamp, frame_duration_ns);+ let remap = source.clock_state.remap_preserving_cadence(+ &self.master_clock,+ raw_timestamp,+ frame_duration_ns,+ );if matches!(remap.outcome, SourceClockOutcome::HardReset) {let flushed = source.buffer.len();@@ -783,7 +784,7 @@ fn sample_position() -> i128 {let nanos = timestamp.duration_since(timestamps).as_nanos() as i128- start.duration_since(timestamps).as_nanos() as i128;- (nanos * rate as i128 + 500_000_000) / 1_000_000_000+ (nanos * rate as i128 + 500_000_000).div_euclid(1_000_000_000)}fn silence_frame(info: AudioInfo, samples: usize) -> ffmpeg::frame::Audio {@@ -1133,6 +1134,17 @@ mod test {assert_eq!(probe.peaks(1), [14_400, 72_000]);}+ #[test]+ fn pcm_sub_timeout_gap_is_not_smoothed_away() {+ let mut probe = PcmProbe::new(2);+ probe.send(1, 0, 4_800, None);+ probe.send(0, 0, 960, Some(0));+ probe.send(0, 30, 960, Some(0));+ probe.send(0, 50, 2_400, Some(0));+ probe.tick(100);+ assert_eq!(probe.peaks(0), [0, 1_440, 2_400]);+ }+#[test]fn pcm_single_input_is_unchanged_and_reset_keeps_the_supplied_cursor() {let mut probe = PcmProbe::new(1);