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
+21 -15
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();
warn!( tokio::spawn(async move {
target: "chanora_core", if let Err(audio_err) = session.ensure_audio_running().await {
error = %audio_err, warn!(
"auto-join default channel: server placed us in a channel but audio engine \ target: "chanora_core",
failed to start; continuing with no-audio in-channel state" error = %audio_err,
); "auto-join default channel: server placed us in a channel but audio engine \
let _ = self.events_tx.send(SessionEvent::AudioStopped); failed to start; continuing with no-audio in-channel state"
} );
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"))]
{ {