Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(audio): initialize buffer model ownership before cleanup
Richie McIlroyc91395110d0c
diff --git a/.github/workflows/sync-tests.yml b/.github/workflows/sync-tests.ymlindex b6f673180..6367e4c7b 100644--- a/.github/workflows/sync-tests.yml+++ b/.github/workflows/sync-tests.yml@@ -26,6 +26,7 @@ on:- "crates/editor/**"- "crates/export/**"- "crates/audio/**"+ - "crates/rnnoise/**"- "crates/media-info/**"- "crates/project/**"- "scripts/recording-reliability.py"@@ -87,6 +88,9 @@ jobs:shell: pwshrun: Add-Content -Path $env:GITHUB_PATH -Value "${{ github.workspace }}\\target\\ffmpeg\\bin"+ - name: RNNoise lifecycle regression tests+ run: cargo test --locked -p cap-rnnoise --lib+- name: Recording metadata and harness regression testsshell: bashrun: |diff --git a/crates/rnnoise/src/lib.rs b/crates/rnnoise/src/lib.rsindex e3314905d..0413254bd 100644--- a/crates/rnnoise/src/lib.rs+++ b/crates/rnnoise/src/lib.rs@@ -68,6 +68,27 @@ impl Drop for DenoiseState {mod tests {use super::*;+ #[test]+ #[cfg(any(target_os = "macos", target_os = "linux"))]+ fn buffered_model_cleanup_handles_nonzero_allocations() {+ let mut child = std::process::Command::new(std::env::current_exe().unwrap());+ child.args([+ "--exact",+ "tests::bundled_model_is_aligned_and_handles_silence",+ "--nocapture",+ ]);+ #[cfg(target_os = "macos")]+ child+ .env("MallocNanoZone", "0")+ .env("MallocScribble", "1")+ .env("MallocPreScribble", "1");+ #[cfg(target_os = "linux")]+ child+ .env("MALLOC_PERTURB_", "165")+ .env("GLIBC_TUNABLES", "glibc.malloc.tcache_count=0");+ assert!(child.status().unwrap().success());+ }+#[test]fn bundled_model_is_aligned_and_handles_silence() {assert_eq!(MODEL.0.as_ptr() as usize % 64, 0);diff --git a/crates/rnnoise/vendor/src/denoise.c b/crates/rnnoise/vendor/src/denoise.cindex b6fc3d4a9..22dfb70f2 100644--- a/crates/rnnoise/vendor/src/denoise.c+++ b/crates/rnnoise/vendor/src/denoise.c@@ -235,6 +235,7 @@ struct RNNModel {RNNModel *rnnoise_model_from_buffer(const void *ptr, int len) {RNNModel *model;model = malloc(sizeof(*model));+ model->file = NULL;model->blob = NULL;model->const_blob = ptr;model->blob_len = len;@@ -502,4 +503,3 @@ float rnnoise_process_frame(DenoiseState *st, float *out, const float *in) {RNN_COPY(st->delayed_Exp, Exp, NB_BANDS);return vad_prob;}-