fix(core): unblock iOS connect audio startup

This commit is contained in:
Edison Jwa
2026-05-31 22:29:30 +09:00
parent 0e04dac064
commit d39d6c78d2
+14 -8
View File
@@ -891,15 +891,18 @@ impl ChanoraSession {
if let Some(projection) = projection { if let Some(projection) = projection {
self.emit_voice_state(projection).await; self.emit_voice_state(projection).await;
} }
if let Err(audio_err) = self.ensure_audio_running().await { let session = self.clone();
tokio::spawn(async move {
if let Err(audio_err) = session.ensure_audio_running().await {
warn!( warn!(
target: "chanora_core", target: "chanora_core",
error = %audio_err, error = %audio_err,
"auto-join default channel: server placed us in a channel but audio engine \ "auto-join default channel: server placed us in a channel but audio engine \
failed to start; continuing with no-audio in-channel state" failed to start; continuing with no-audio in-channel state"
); );
let _ = self.events_tx.send(SessionEvent::AudioStopped); let _ = session.events_tx.send(SessionEvent::AudioStopped);
} }
});
} }
Ok(snap) Ok(snap)
@@ -1388,11 +1391,12 @@ impl ChanoraSession {
Some(audio.audio_processing_stats()) Some(audio.audio_processing_stats())
} }
/// Configure the preferred Silero ONNX VAD model path. /// Configure the preferred Silero ONNX VAD model path on platforms
/// that ship the ONNX detector.
/// ///
/// This does not require an active connection. Running iOS audio /// This does not require an active connection. Running non-iOS
/// backends observe the model-path epoch and reload on the next /// audio backends can observe the model-path epoch and reload on
/// capture frame when Silero is selected. /// the next capture frame when Silero is selected.
pub async fn set_vad_model_path(&self, path: String) -> Result<(), CoreError> { pub async fn set_vad_model_path(&self, path: String) -> Result<(), CoreError> {
chanora_audio::vad::set_silero_model_path(&path)?; chanora_audio::vad::set_silero_model_path(&path)?;
Ok(()) Ok(())
@@ -1404,8 +1408,10 @@ impl ChanoraSession {
let guard = self.inner.lock().await; let guard = self.inner.lock().await;
if let Some(state) = guard.as_ref() { if let Some(state) = guard.as_ref() {
if let Some(audio) = state.audio.as_ref() { if let Some(audio) = state.audio.as_ref() {
let mut config = audio.audio_processing_config_snapshot(); let config = chanora_audio::route_policy::apply_route_change(
config.route = route; &audio.audio_processing_config_snapshot(),
route,
);
audio.set_audio_processing_config(config)?; audio.set_audio_processing_config(config)?;
#[cfg(any(target_os = "ios", target_os = "macos"))] #[cfg(any(target_os = "ios", target_os = "macos"))]
{ {