diff --git a/Cargo.lock b/Cargo.lock index 0ce5436..da6a549 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7202,8 +7202,9 @@ name = "wzp-desktop" version = "0.1.0" dependencies = [ "anyhow", - "coreaudio-rs", + "jni", "libloading 0.8.9", + "ndk-context", "rustls", "serde", "serde_json", diff --git a/crates/wzp-client/Cargo.toml b/crates/wzp-client/Cargo.toml index 0258107..b9f6a1b 100644 --- a/crates/wzp-client/Cargo.toml +++ b/crates/wzp-client/Cargo.toml @@ -23,13 +23,21 @@ serde_json = "1" chrono = "0.4" rustls = { version = "0.23", default-features = false, features = ["ring", "std"] } cpal = { version = "0.15", optional = true } -coreaudio-rs = { version = "0.11", optional = true } libc = "0.2" +# coreaudio-rs is Apple-framework-only; gate it to macOS so enabling +# the `vpio` feature from a non-macOS target builds cleanly instead of +# pulling in a crate that can only link against Apple frameworks. +[target.'cfg(target_os = "macos")'.dependencies] +coreaudio-rs = { version = "0.11", optional = true } + [features] default = [] audio = ["cpal"] -vpio = ["coreaudio-rs"] +# vpio enables coreaudio-rs but that dep is itself gated to macOS above, +# so enabling this feature on Windows/Linux is a no-op (the audio_vpio +# module is also #[cfg(target_os = "macos")] in lib.rs). +vpio = ["dep:coreaudio-rs"] [[bin]] name = "wzp-client" diff --git a/crates/wzp-client/src/lib.rs b/crates/wzp-client/src/lib.rs index 136d4fc..8d134ff 100644 --- a/crates/wzp-client/src/lib.rs +++ b/crates/wzp-client/src/lib.rs @@ -10,7 +10,10 @@ pub mod audio_io; #[cfg(feature = "audio")] pub mod audio_ring; -#[cfg(feature = "vpio")] +// VoiceProcessingIO is an Apple Core Audio API — only compile the module +// when the `vpio` feature is on AND we're targeting macOS. Enabling the +// feature on Windows/Linux was previously silently broken. +#[cfg(all(feature = "vpio", target_os = "macos"))] pub mod audio_vpio; pub mod bench; pub mod call; diff --git a/desktop/src-tauri/Cargo.toml b/desktop/src-tauri/Cargo.toml index fe8934f..2ad750d 100644 --- a/desktop/src-tauri/Cargo.toml +++ b/desktop/src-tauri/Cargo.toml @@ -51,16 +51,29 @@ wzp-fec = { path = "../../crates/wzp-fec" } wzp-crypto = { path = "../../crates/wzp-crypto" } wzp-transport = { path = "../../crates/wzp-transport" } -# wzp-client pulls CPAL + (on macOS) VoiceProcessingIO — desktop only. -# Android gets an oboe/AAudio backend in Step 3 of the Tauri mobile rewrite. -[target.'cfg(not(target_os = "android"))'.dependencies] +# wzp-client pulls in CPAL on every desktop target and, additionally on +# macOS, VoiceProcessingIO (coreaudio-rs behind the "vpio" feature). The +# vpio feature MUST NOT be enabled on Windows / Linux because coreaudio-rs +# is Apple-framework-only and will fail to build. Task #24 will add a +# matching Windows Voice Capture DSP path behind its own feature; until +# then, Windows desktops use plain CPAL with AEC disabled. + +# macOS: CPAL + VoiceProcessingIO (hardware AEC via Core Audio). +[target.'cfg(target_os = "macos")'.dependencies] wzp-client = { path = "../../crates/wzp-client", features = ["audio", "vpio"] } -# Step B: depend on wzp-client on Android WITHOUT the audio/vpio features, -# so we pull in only the platform-independent modules (call, handshake, -# audio_ring, codec bindings). Deliberately no imports in lib.rs yet — we -# only want to verify that compiling + linking these crates on android -# doesn't regress the working build. +# Windows: CPAL only. Windows AEC (WASAPI Communications / MF Voice +# Capture DSP) lands in a follow-up task. See task #24. +[target.'cfg(target_os = "windows")'.dependencies] +wzp-client = { path = "../../crates/wzp-client", features = ["audio"] } + +# Linux: same as Windows for now — plain CPAL. +[target.'cfg(target_os = "linux")'.dependencies] +wzp-client = { path = "../../crates/wzp-client", features = ["audio"] } + +# Android: no CPAL, no vpio — audio goes through the standalone wzp-native +# cdylib that we dlopen via libloading at runtime. See the wzp_native +# module in src/. [target.'cfg(target_os = "android")'.dependencies] wzp-client = { path = "../../crates/wzp-client", default-features = false } # libloading: runtime dlopen of libwzp_native.so — the standalone cdylib @@ -75,10 +88,6 @@ libloading = "0.8" jni = "0.21" ndk-context = "0.1" -# Platform-specific -[target.'cfg(target_os = "macos")'.dependencies] -coreaudio-rs = "0.11" - [features] default = ["custom-protocol"] custom-protocol = ["tauri/custom-protocol"]