From c48f892fb444433beed2ca4fe5e73c0c32de516e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Monnom?= Date: Thu, 14 Nov 2024 16:51:27 +0100 Subject: [PATCH 1/2] soxr: fix segfault when pushing after a flush (#486) --- livekit-ffi/src/server/resampler.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/livekit-ffi/src/server/resampler.rs b/livekit-ffi/src/server/resampler.rs index ad2eaa75..6faa68b0 100644 --- a/livekit-ffi/src/server/resampler.rs +++ b/livekit-ffi/src/server/resampler.rs @@ -127,6 +127,13 @@ impl SoxResampler { return Err(error_msg.to_string_lossy().to_string()); } + let error = unsafe { soxr_sys::soxr_clear(self.soxr_ptr) }; + + if !error.is_null() { + let error_msg = unsafe { std::ffi::CStr::from_ptr(error) }; + return Err(error_msg.to_string_lossy().to_string()); + } + Ok(&self.out_buf[..odone]) } } From b41861c7b71762d5d85b3de07ae67ffcae7c3fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Thu, 14 Nov 2024 21:34:07 +0100 Subject: [PATCH 2/2] ffi v0.12.3 --- livekit-ffi/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/livekit-ffi/Cargo.toml b/livekit-ffi/Cargo.toml index 7d6e8d04..7109c254 100644 --- a/livekit-ffi/Cargo.toml +++ b/livekit-ffi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "livekit-ffi" -version = "0.12.2" +version = "0.12.3" edition = "2021" license = "Apache-2.0" description = "FFI interface for bindings in other languages"