`voelinctl stream bench`, release builds (fat LTO), VP8, desktop test
pattern, one layer, 8 s, shared 4-core VM, before/after interleaved.
Before: the single-threaded allocating pipeline (a89ac5f). After: the
threaded pipeline (quiet column: ffc79e6; busy column: f6a4ae3).
fps sent / CPU cores / heap allocations per encoded frame:
quiet (load 1-3) busy (load 6-12)
before after before after
720p30 29.4/0.48/7.1 30.0/0.40/1.05 7.9/1.71/10.0 6.6/1.24/1.25
720p60 14.7/2.37/10.2 60.0/0.69/1.03 4.6/1.23/19.1 6.4/1.28/1.25
1080p30 29.6/0.83/7.1 30.0/0.75/1.05 2.7/1.30/17.4 6.9/1.27/1.24
1080p60 57.2/1.47/7.1 53.7/1.42/1.03 2.4/1.33/31.4 5.7/1.40/1.28
1440p30 8.4/2.26/9.7 22.7/1.71/1.07 1.9/1.31/22.6 5.5/1.26/1.30
1440p60 52.5/2.24/7.2 3.2/2.02/1.50* 1.5/1.22/36.9 3.6/1.30/1.45
* libvpx with one thread per core collapsed when conversion competed for
a core (290 ms per frame); f6a4ae3 leaves a core free.
On an idle machine (load < 1, earlier) the old pipeline reached
30/60/30/58/30/60 fps at 0.4-1.8 cores; the machine never got that
quiet again for an after run. Allocations per encoded frame: 7-37 before
(5-450 MB), about 1 after (the `Arc<[u8]>` of the encoded frame, 10-130
KB); zero on the capture -> convert -> scale -> encode path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
libvpx's worker threads wait on each other by spinning. With one thread
per core, an encode slows down many times over as soon as anything else
wants a core: the capture and conversion of the next frame, another
layer, the desktop. The bench on a 4-core machine showed single frames
at 1080p and 1440p taking 130-290 ms with 4 threads under load, where the
same frames took 9-17 ms with 3 threads next to two other layers. The
default (`codec::encoder_cpus`) is now all CPUs but one, for single
encoders and for the streamer's split across layers; an explicit
`EncoderConfig::threads` still wins.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
The bench showed the adaptive `cpu-used` oscillating: with headroom at
-6 it stepped VP8 down to -5 and -4, which on screen content cost about
ten times the encode time for under 1 dB, the encoder fell behind, frames
were dropped, and it stepped back up. VP8 now stays within -10..-6. A
single frame that takes longer than the whole frame interval makes the
encoder faster at once, and when a slower level has to be undone, the
next attempt to go slower waits twice as long (up to 16x 15 frames).
The simulcast test also checks that `EncodedSource::set_layer_bitrate`
reaches exactly that layer's encoder.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
`cargo bench -p voelin-media --bench convert` times, at 720p, 1080p and
1440p of the desktop test pattern: the old allocating one-thread
`to_i420`, the `Converter` on one thread and on all cores, the pyramid
(full, half and quarter size), and luma scaling to half (2x2 box) and to
2/3 (area average). criterion 0.8 is already in the lock file (the proto
crates use it), Apache-2.0 OR MIT.
docs/media.md describes the threaded simulcast pipeline, reconfigure and
the stats, the capture sinks, portal DMA-BUFs, the wlroots backend, the
libvpx settings, how to benchmark, the allocation behaviour, the modules
with unsafe code, and the test status.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
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
Brings the Android app. tsc-ui keeps its RunOptions (secrets, hosted
engine) and safe-area padding; it asks tsc-core for media-desktop on
desktop and media on Android, OpenH264 only on desktop, hotkey backends
only on desktop. A window with a hosted engine leaves its sessions open
on exit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
docs/media.md describes tsc-core's media module and what was tested,
docs/audio.md the settings, level meter, client and stream volumes and
global push-to-talk, the protocol notes the confirmed finding that the
server does not announce running streams to clients that connect later.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
- tests/codec_roundtrip.rs: synthetic pattern -> VP8 / VP9 -> decode
(PSNR, rectangle and background colours, forced keyframes, bitrate
change) and capture thread -> encoder -> decoder
- tests/x11_capture.rs: draws windows on a real X server ($DISPLAY, e.g.
Xvfb), checks MIT-SHM and GetImage pixels, window listing, window
capture -> VP8 -> decode colours, and cursor drawing; skipped without
DISPLAY
- tests/openh264.rs: missing-library errors; with TSC_OPENH264_LIB a full
H.264 roundtrip incl. SPS profile checks (High 100, Baseline 66); an
ignored test downloads Cisco's binary and runs the roundtrip
- OpenH264: allow frame skipping so rate control holds the bitrate, no
adaptive quantisation / background detection for screen content
- docs/media.md: API, backends, features, build requirements, licenses
(OpenH264 runtime download and attribution), verification status
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G