refactor(audio): share AudioHandler between iOS and macOS, bump deps
crates/chanora_audio/src/engine.rs: drop the macOS-specific event-queue producer/consumer path; macOS now uses the iOS-style direct AudioHandler::fill_buffer in the VPIO render callback. The shared AudioHandler is an Arc<Mutex<...>>; the realtime callback uses try_lock so it never blocks on the tokio decode task (see ios_voice_unit.rs render callback). crates/chanora_audio/src/mobile_voice_backend.rs: update VoiceAudioParams cfg gates — handler is now the iOS/macOS/desktop shape (Arc<Mutex<AudioHandler<SessionAudioId>>>), event_producer is Android-only. crates/chanora_audio/src/lib.rs: widen the audio_event_queue module visibility to test so the macOS-specific path can be exercised by the unit test suite. Cargo.toml: bump cpal 0.17.3 -> 0.18.0, jni 0.21 -> 0.22.4, windows 0.54 -> 0.62, criterion 0.5 -> 0.8. Cargo.lock follows.
This commit is contained in:
@@ -78,15 +78,18 @@ pub(crate) struct VoiceAudioParams {
|
||||
pub frames_sent: Arc<AtomicU32>,
|
||||
/// Pre-encode amplitude scale (1.0 = unity).
|
||||
pub mic_gain: f32,
|
||||
/// AudioHandler owned by the Android/macOS output callback.
|
||||
#[cfg(any(target_os = "android", target_os = "macos"))]
|
||||
/// AudioHandler owned by the Android output callback.
|
||||
#[cfg(target_os = "android")]
|
||||
pub handler: AudioHandler<SessionAudioId>,
|
||||
/// Producer used by Android/macOS engine tasks to feed the output callback.
|
||||
#[cfg(any(target_os = "android", target_os = "macos"))]
|
||||
/// Producer used by Android engine tasks to feed the output callback.
|
||||
#[cfg(target_os = "android")]
|
||||
pub event_producer: crate::audio_event_queue::AudioEventProducer,
|
||||
/// AudioHandler that inbound decode+mix feeds into; the output
|
||||
/// callback pulls mixed stereo f32 from it.
|
||||
#[cfg(not(any(target_os = "android", target_os = "macos")))]
|
||||
/// callback pulls mixed stereo f32 from it. iOS, macOS, and desktop
|
||||
/// share this `Arc<Mutex<...>>` shape; the realtime callback uses
|
||||
/// `try_lock` so it never blocks on the tokio decode task (see
|
||||
/// `ios_voice_unit.rs` render callback).
|
||||
#[cfg(not(target_os = "android"))]
|
||||
pub handler: Arc<Mutex<AudioHandler<SessionAudioId>>>,
|
||||
/// Master output gain (f32 bits stored in AtomicU32 for lock-free
|
||||
/// cross-thread read from the realtime audio callback).
|
||||
|
||||
Reference in New Issue
Block a user