fix(android): 8s Rust timeout on audio_start; always emit connect: debug events

- engine.rs: wrap spawn_blocking(audio_start) in an 8s tokio timeout so
  the connect command fails fast with a clear error if the Oboe HAL
  never returns, instead of blocking the JS 45s timer
- lib.rs: emit_call_debug now always forwards connect: and
  register_signal: steps to the JS overlay regardless of the debug-logs
  toggle — needed because app-data clears reset the toggle to false,
  making join failures invisible on first install
- main.ts: JS timeout bumped to 45s (Rust 8s fires first); timeout
  message now includes last native connect: step so the toast is
  actionable without opening the debug log

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-05-25 07:49:21 +04:00
parent 2aa6582585
commit 394987a349
3 changed files with 48 additions and 19 deletions

View File

@@ -683,19 +683,32 @@ impl CallEngine {
"connect:audio_start_start",
serde_json::json!({ "t_ms": t_pre_audio }),
);
let audio_start_result = tokio::task::spawn_blocking(crate::wzp_native::audio_start)
.await
.map_err(|e| {
crate::emit_call_debug(
&app,
"connect:audio_start_panic",
serde_json::json!({
"t_ms": call_t0.elapsed().as_millis(),
"error": e.to_string(),
}),
);
anyhow::anyhow!("audio_start task panic: {e}")
})?;
let audio_start_task = tokio::task::spawn_blocking(crate::wzp_native::audio_start);
let audio_start_result =
match tokio::time::timeout(std::time::Duration::from_secs(8), audio_start_task).await {
Ok(join_result) => join_result.map_err(|e| {
crate::emit_call_debug(
&app,
"connect:audio_start_panic",
serde_json::json!({
"t_ms": call_t0.elapsed().as_millis(),
"error": e.to_string(),
}),
);
anyhow::anyhow!("audio_start task panic: {e}")
})?,
Err(_) => {
crate::emit_call_debug(
&app,
"connect:audio_start_timeout",
serde_json::json!({
"t_ms": call_t0.elapsed().as_millis(),
"timeout_ms": 8000,
}),
);
return Err(anyhow::anyhow!("wzp_native_audio_start timed out after 8s"));
}
};
if let Err(code) = audio_start_result {
crate::emit_call_debug(
&app,