feat(voice): replaced miniaudio with native platform audio backends

- Replaced the miniaudio dependency with custom OS audio device abstractions and backends.
- Implemented platform-specific audio playback and capture for macOS (Audio Queue), Windows (WASAPI), and Linux (PulseAudio/ALSA).
- Added a fallback stub backend returning errors for unsupported platforms.
- Updated audio stream handling with reliable fill guard wakeups and streamlined rate validation.
This commit is contained in:
can1357
2026-08-07 23:34:16 +02:00
parent bc5eee4e24
commit 7cae7ef3f5
17 changed files with 2555 additions and 14386 deletions
+4 -21
View File
@@ -33,20 +33,6 @@ strip = true
# (see crates/pi-natives/src/crash_handler.rs).
panic = "unwind"
# rustc ICEs codegenning `MaybeUninit<maudio_sys::ffi::ma_fence>` — a union with
# ScalarPair backend repr on x86_64-pc-windows-msvc — once the MIR opts that run
# from opt-level 2 upward const-fold it into an `Uninit` operand
# (`rustc_codegen_ssa/src/mir/block.rs`: "codegen_argument: OperandRef(Uninit …)
# invalid for pair argument"). Hit by the rustup toolchain this repo pins
# (nightly-2026-07-28) on the local napi path (`packages/natives` →
# `build:bindings`); Bazel's older pin (nightly/2026-04-29, MODULE.bazel) is
# unaffected, which is why CI never saw it. opt-level 1 keeps those MIR opts off.
# maudio is a thin FFI shim — miniaudio itself is C compiled by `cc` at its own
# optimization level — so the cost is noise. Drop this once the rustup pin moves
# past the fix. `ci` and `local` inherit this override from `release`.
[profile.release.package.maudio]
opt-level = 1
[profile.ci]
inherits = "release"
lto = "thin"
@@ -75,9 +61,6 @@ split-debuginfo = "unpacked"
opt-level = 2
debug = false
[profile.dev.package.maudio]
opt-level = 1
[workspace.lints.rust]
# ──────────────────────────────────────────────────────────────────────────────
# Rust Lint Levels
@@ -256,14 +239,10 @@ smallvec = { version = "1.15.1", features = [
# ──────────────────────────────────────────────────────────────────────────────
xxhash-rust = { version = "0.8", features = ["xxh64"] }
# ──────────────────────────────────────────────────────────────────────────────
# Audio & Realtime Media
# ──────────────────────────────────────────────────────────────────────────────
audiopus_sys = { version = "0.2.2", features = ["static"] }
# Pregenerated bindings (crate default): keeps bindgen/libclang out of the
# build graph so Bazel actions stay hermetic.
maudio = "0.1.6"
opus = "0.3.1"
webrtc = "0.17.2"
@@ -274,12 +253,16 @@ libc = "0.2"
os_pipe = "1"
windows-sys = { version = "0.61", features = [
"Win32_Foundation",
"Win32_Media_Audio",
"Win32_Media_Multimedia",
"Win32_Security",
"Win32_Storage_FileSystem",
"Win32_Storage_ProjectedFileSystem",
"Win32_System_Com",
"Win32_System_LibraryLoader",
"Win32_System_IO",
"Win32_System_Ioctl",
"Win32_System_Threading",
] }
winreg = "0.56"