Skip to content

Commit

Permalink
soxr: fix segfault when pushing after a flush (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
theomonnom authored Nov 14, 2024
1 parent 3c70895 commit c48f892
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions livekit-ffi/src/server/resampler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}
}
Expand Down

0 comments on commit c48f892

Please sign in to comment.