The product is Voelin (app id io.github.faumaray.Voelin), everywhere: - crates tsc-* -> voelin-* (and voelin-fuzz), the desktop binary tsc-desktop -> voelin, the development CLI tsctl -> voelinctl; - the Android app: applicationId, Kotlin package io.github.faumaray.voelin, VoelinApp, libvoelin_android.so (JNI class names follow); - TSC_* environment variables -> VOELIN_*, Gradle properties tsc.* -> voelin.*, signing secrets VOELIN_SIGNING_*; - the data/config/cache/state folder tsc -> voelin, the keyring service, thread names, the dev compose project; - desktop file, metainfo, icon, Flatpak manifest, NSIS installer, docs. The gateway keeps its name: bin tsgw (crate voelin-gateway), TSGW_* env vars, the tsgw.v1+json protocol, the tsgw image. The window title and the About page show "Voelin <version>" from voelin_platform::APP_NAME. Packages (scripts/package.sh): the app only (voelin, voelin.exe, APKs, Flatpak). voelinctl is a development tool and in no package. tsgw is for servers and now its own Linux package, tsgw_<v>_amd64.deb and tsgw-<v>-linux-x86_64.tar.gz, with a sandboxed systemd unit (packaging/linux/tsgw.service; /etc/tsgw config, /var/lib/tsgw state) and dependencies of its own (no GUI libraries). docs/gateway-admin.md has an Install section. Fixes: - package-windows: makensis on Windows found no file through "D:/a/..." paths; pass Windows paths (cygpath -w). - StartupWMClass is the app id, which the app sets as its X11 WM_CLASS (it was the binary name, so desktops could not match the window). - Gradle wrapper download timeout 10 s -> 60 s (slow proxies). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
86 lines
2.6 KiB
Rust
86 lines
2.6 KiB
Rust
//! Two peers on loopback: offer/answer, then video and audio frames flow.
|
|
|
|
use std::time::Duration;
|
|
|
|
use tokio::time::timeout;
|
|
use voelin_stream::{MediaKind, MediaTime, Peer, PeerConfig, PeerEvent};
|
|
|
|
/// Bytes that look like a VP8 keyframe (frame tag + start code), then filler.
|
|
pub fn fake_vp8_keyframe(seq: u8, len: usize) -> Vec<u8> {
|
|
let mut f = vec![0x10, 0x02, 0x00, 0x9d, 0x01, 0x2a, 0x80, 0x02, 0xe0, 0x01];
|
|
f.extend((0..len).map(|i| (i as u8) ^ seq));
|
|
f
|
|
}
|
|
|
|
async fn wait_connected(peer: &mut Peer) {
|
|
timeout(Duration::from_secs(10), async {
|
|
loop {
|
|
match peer.next_event().await {
|
|
Some(PeerEvent::Connected) => return,
|
|
Some(PeerEvent::Closed) | None => panic!("closed before connecting"),
|
|
_ => {}
|
|
}
|
|
}
|
|
})
|
|
.await
|
|
.expect("connect timeout");
|
|
}
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
async fn media_flows_over_loopback() {
|
|
let _ = tracing_subscriber::fmt().with_env_filter("warn").with_test_writer().try_init();
|
|
let config = PeerConfig::loopback();
|
|
let (mut streamer, offer) = Peer::offer(&config, "test-stream").await.unwrap();
|
|
assert!(offer.contains("VP8"), "{offer}");
|
|
let (mut viewer, answer) = Peer::answer(&config, &offer).await.unwrap();
|
|
streamer.accept_answer(&answer).await.unwrap();
|
|
assert!(streamer.accept_answer(&answer).await.is_err(), "second answer must fail");
|
|
|
|
let (a, b) = tokio::join!(wait_connected(&mut streamer), wait_connected(&mut viewer));
|
|
let ((), ()) = (a, b);
|
|
|
|
// 1.5 s of 30 fps video (large frames need several packets) and 20 ms Opus frames.
|
|
let sender = tokio::spawn(async move {
|
|
for i in 0..45u64 {
|
|
let frame = fake_vp8_keyframe(i as u8, 3000);
|
|
streamer.write(MediaKind::Video, MediaTime::from_90khz(i * 3000), frame);
|
|
for j in 0..2u64 {
|
|
let n = i * 2 + j;
|
|
streamer.write(
|
|
MediaKind::Audio,
|
|
MediaTime::new(n * 960, voelin_stream::Frequency::FORTY_EIGHT_KHZ),
|
|
vec![0xfc, n as u8, 1, 2, 3],
|
|
);
|
|
}
|
|
tokio::time::sleep(Duration::from_millis(33)).await;
|
|
}
|
|
streamer
|
|
});
|
|
|
|
let (mut video, mut audio) = (0, 0);
|
|
let _ = timeout(Duration::from_secs(5), async {
|
|
while let Some(event) = viewer.next_event().await {
|
|
if let PeerEvent::Media(frame) = event {
|
|
match frame.kind {
|
|
MediaKind::Video => {
|
|
assert_eq!(frame.codec, voelin_stream::Codec::Vp8);
|
|
assert_eq!(frame.data.len(), 3010, "whole frame reassembled");
|
|
video += 1;
|
|
}
|
|
MediaKind::Audio => {
|
|
assert_eq!(frame.data[0], 0xfc);
|
|
audio += 1;
|
|
}
|
|
}
|
|
if video >= 40 && audio >= 80 {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
})
|
|
.await;
|
|
let streamer = sender.await.unwrap();
|
|
assert!(video >= 40 && audio >= 80, "received {video} video / {audio} audio frames");
|
|
drop(streamer);
|
|
}
|