test(app): keep hearing a speaker across DAVE group changes, and record the Rust decision
- Live test: the speaker leaves and rejoins three times; each time its sentence is heard exactly under the new SSRC (songbird issue #310 reports receive stalls after group changes; not reproduced). - decisions.md: Rust over Electron, with the side-by-side results, the songbird risk and the fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -331,7 +331,38 @@ async fn discord_voice_core_on_real_discord() {
|
||||
tokio::time::sleep(Duration::from_millis(500)).await;
|
||||
assert!(!events.lock().unwrap().iter().any(|e| matches!(e, CoreEvent::Chat(c) if c.content == reply)));
|
||||
|
||||
// 6. Leaving.
|
||||
// 6. Group changes: every join and leave changes the DAVE (MLS) group, and songbird has an open
|
||||
// report of receive stalling after one (issue #310). The speaker leaves and comes back three
|
||||
// times and must still be heard each time, under its new SSRC.
|
||||
let wav = std::fs::read(samples.join("ko_03.wav")).unwrap();
|
||||
let reference = refs["samples"][2]["text"].as_str().unwrap().to_owned();
|
||||
let mut rejoins = vec![];
|
||||
for round in 0..3 {
|
||||
speaker_songbird.remove(GuildId::new(guild)).await.unwrap();
|
||||
tokio::time::sleep(Duration::from_secs(2)).await;
|
||||
let call = speaker_songbird.join(GuildId::new(guild), ChannelId::new(voice)).await.expect("speaker rejoins");
|
||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||
let before = events.lock().unwrap().len();
|
||||
let (etx, mut erx) = mpsc::unbounded_channel();
|
||||
let track = call.lock().await.play_only_input(Input::from(wav.clone()));
|
||||
track.add_event(Event::Track(TrackEvent::End), Ended(etx)).unwrap();
|
||||
tokio::time::timeout(Duration::from_secs(20), erx.recv()).await.expect("track end");
|
||||
let got = |evs: &[CoreEvent]| evs.iter().filter_map(|e| match e {
|
||||
CoreEvent::Final(f) if f.heard.speaker_id == speaker_id && !f.text.is_empty() => Some(f.text.clone()),
|
||||
_ => None,
|
||||
}).collect::<Vec<_>>();
|
||||
let deadline = Instant::now() + Duration::from_secs(10);
|
||||
while got(&events.lock().unwrap()[before..]).is_empty() && Instant::now() < deadline {
|
||||
tokio::time::sleep(Duration::from_millis(50)).await;
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(800)).await;
|
||||
let hyp = got(&events.lock().unwrap()[before..]).join(" ");
|
||||
rejoins.push(json!({"round": round, "hyp": hyp, "cer": cer(&reference, &hyp)}));
|
||||
}
|
||||
report.insert("rejoins".into(), Value::from(rejoins.clone()));
|
||||
assert!(rejoins.iter().all(|r| r["cer"].as_f64().unwrap() < 0.15), "not heard after a rejoin: {rejoins:?}");
|
||||
|
||||
// 7. Leaving.
|
||||
assert!(core.leave("command").await);
|
||||
until("Jarvis to leave", 10_000, || {
|
||||
s_cache.guild(GuildId::new(guild)).and_then(|g| g.voice_states.get(&UserId::new(jarvis)).and_then(|v| v.channel_id)).is_none()
|
||||
|
||||
Reference in New Issue
Block a user