Repository navigation
obs-media-io: Move the audio-io engine out of the safe core into src/ffi - #413
Merged
Merged
Conversation
The audio-io port's 46 unsafe sites now fail the crate's deny(unsafe_code). Refs #294
audio_io/port.rs becomes ffi/audio_output.rs: every tick calls C callbacks, resampler handles and libobs symbols through raw pointers, so it belongs with the C boundary. audio_io.rs keeps the safe header inlines and re-exports the engine, and the crate now allows unsafe_code only on mod ffi and platform::unix. Closes #294 Local-Gate: v1 tree=1cffc0bfdbfc81b5824c3e97a74fbd35be5b9b1e secs=241 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791849002,"gate":"rust/all/fmt","host":"linux-x86_64","key":"d834eedcfce3a821bcd0dc4adbe2721cf9084a49947d3986f39296d2cb4e275c","lane":"lint","parents":["1d7dabebb87051327bbc6960d44ff0d31ec88730"],"secs":37,"stamp":"fef10032725e11d5c383d8456dbc01e2","tree":"1cffc0bfdbfc81b5824c3e97a74fbd35be5b9b1e","v":1,"via":"run"} Ci-Attestation: {"at":1791849002,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"d834eedcfce3a821bcd0dc4adbe2721cf9084a49947d3986f39296d2cb4e275c","lane":"lint","parents":["1d7dabebb87051327bbc6960d44ff0d31ec88730"],"secs":37,"stamp":"2b6c0623a42b4cd172083353cb19ec7f","tree":"1cffc0bfdbfc81b5824c3e97a74fbd35be5b9b1e","v":1,"via":"run"} Ci-Attestation: {"at":1791849002,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"ba82d0368220d0ae65a92dd3ff970a0a233b376115c067d6711e20db0d0c6528","lane":"rust-test","parents":["1d7dabebb87051327bbc6960d44ff0d31ec88730"],"secs":77,"stamp":"0b1fb8efbe3d7461a41ebf7d48b83eba","tree":"1cffc0bfdbfc81b5824c3e97a74fbd35be5b9b1e","v":1,"via":"run"} Ci-Attestation: {"at":1791849002,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"edeb3ced96e581c68c0b85d2c4b02e8159e72feee16c0554e54de54154edeab8","lane":"tier2-linux","parents":["1d7dabebb87051327bbc6960d44ff0d31ec88730"],"secs":128,"stamp":"f274ae6acc825d44c628c3a3fe7e164c","tree":"1cffc0bfdbfc81b5824c3e97a74fbd35be5b9b1e","v":1,"via":"run"}
This was referenced Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #294. Part of #297.
#[allow(unsafe_code)]onmod audio_io, so the crate fails with 46unsafe_codeerrors.audio_io/port.rsmoves tosrc/ffi/audio_output.rs. Every tick calls C function pointers (input and output callbacks),audio_resampler_*handles and libobsos_*/profiler symbols, and sharesUnsafeCellstate with FFI callers under the recursive lock, so the engine is C-boundary code.audio_io.rskeeps the safe header inlines and re-exportsAudioOutputfor its Rust callers, so the tests and thecompile_faildoctests are unchanged.The crate now allows
unsafe_codeonly onmod ffiandplatform::unix(the pthread mutex, #326).Not done here: a fully safe engine core, with Rust closures in place of C callbacks and a safe re-entrant lock. That would be a redesign, not a move, and gets its own issue if wanted.
Local gate (lint + Dylint, rust-test, tier2-linux OFF/ON) passed and is stamped.
clippy --libis clean forx86_64-pc-windows-msvcandaarch64-apple-darwin.