Measure the voice path through both adapters; test the engine on a registered connector

- A unit test frames 5,000 Opus packets each way through SessionLink, the
  TeamSpeak session and the recording link and prints the cost per packet
  (about 7 microseconds to the host, 10 from it in a debug build; the test
  bounds each direction at 500 microseconds). docs/session-seam.md section 13
  records the figures, which were the one thing slice 1 had not measured.
- tests/session_backends.rs: the engine over voelin-proto's FakeConnector
  through Engine::start_with_backends (connect, server name and backend,
  channels, a move, disconnect), and the registry's error text for an address
  no connector serves.
- The error of a TeamSpeak connector given an address that is not a TeamSpeak
  one no longer prints the query, where a channel password rides.
- The note on the two library tests that need the name localhost to resolve to
  127.0.0.1 says so.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Sonnet 5.5 committed 2026-10-21 00:41:04 +03:00
1 parent 1b7abdf4c7
commit bc9ccbc85e
4 files changed
+184 -9

No files matched your search

+41
View File
@@ -1433,3 +1433,44 @@ async fn the_engine_consumes_any_session_a_connector_makes() {
assert_eq!(reason, None);
assert_eq!(connector.connects().len(), 1);
}
/// What the second adapter costs per voice packet (the last row of the risk
/// table in `docs/session-seam.md`): every packet is framed as RTP and taken
/// apart again on its way, in each direction. A generous bound in a debug
/// build; the figures are printed.
#[tokio::test(flavor = "multi_thread")]
async fn a_voice_packet_costs_microseconds_through_both_adapters() {
const PACKETS: usize = 5_000;
let mut rig = Rig::new(everything()).await;
let started = std::time::Instant::now();
for _ in 0..PACKETS {
rig.give(LinkCmd::Audio(EncodedVoice {
codec: VoiceCodec::Voice,
payload: OPUS_20_MS.to_vec(),
}));
}
for _ in 0..PACKETS {
assert!(matches!(rig.inner_cmd().await, LinkCmd::Audio(_)));
}
let uplink = started.elapsed() / PACKETS as u32;
let started = std::time::Instant::now();
for seq in 0..PACKETS {
rig.play(LinkEvent::Audio(VoicePacket {
talker: TalkerId(8),
seq: seq as u16,
codec: VoiceCodec::Voice,
whisper: false,
payload: OPUS_20_MS.to_vec(),
}));
}
let mut heard = 0;
while heard < PACKETS {
rig.event(|e| matches!(e, LinkEvent::Audio(_)).then_some(())).await;
heard += 1;
}
let downlink = started.elapsed() / PACKETS as u32;
eprintln!("voice through both adapters: {uplink:?} per packet up, {downlink:?} down");
assert!(uplink < Duration::from_micros(500), "{uplink:?}");
assert!(downlink < Duration::from_micros(500), "{downlink:?}");
}
+3 -4
View File
@@ -147,10 +147,9 @@ fn inner_options(params: &ConnectParams, ctx: &LocalCtx) -> Result<ConnectOption
let link = match Link::parse(&params.address) {
Some(Link::Server(link)) => link,
_ => {
return Err(SessionError::Protocol(format!(
"not a TeamSpeak server address: {}",
params.address
)));
// Without the query: a channel password rides in it.
let shown = params.address.split('?').next().unwrap_or_default();
return Err(SessionError::Protocol(format!("not a TeamSpeak server address: {shown}")));
}
};
let identity = match &params.credential {