For measuring streams end to end: `stream start --stats` prints once a
second what the encoder makes per layer (size, fps, kbit/s, target,
encode time), `stream watch --stats` what arrives and decodes (decoded
fps, received bitrate, size, decoder, frames decoded and skipped,
keyframe requests), `stream start --pattern desktop` streams the
code-editor test pattern (about as costly as real screen content), and
`stream --no-bwe` turns bandwidth estimation off, to see what the path
carries unpaced. `Action::Stream` is boxed (the arguments grew past
clippy's limit) and `watch` takes its options in one struct.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Measured at 7680x4320@60 with av1_vaapi at 60 Mbit/s, the CPU path made
27 fps: the pyramid converted each frame to I420 on every core (4.6 ms),
then the encoder thread interleaved it to NV12 and uploaded it into a
VA-API surface on one thread (`encode_with`), 20 ms of its 36.7 ms per
frame, so 81 frames in 5 s were dropped. 3840x2160@120 with h264_vaapi
made 84 fps the same way.
While every encoder takes GPU frames, a picture in memory (shared memory
from the portal, X11, wlroots, the studio's composite, the test pattern)
now takes the GPU path the DMA-BUFs take: `GpuConverter::convert_memory`
copies it as it is (BGRx or RGBx) into a VA-API surface of its own and
converts and scales that for every layer. That copy is all the CPU does:
5.7 ms of the 11.9 a 7680x4320 frame takes (the rest is the GPU's upload
and conversion), one thread, because eight copying threads saved 2 ms for
four times the CPU. Not waiting for the GPU was tried and was slower
(36 fps at 8K60 against 42: the encoder then waited instead).
The test pattern drew a 7680x4320 frame on one thread (230 MB of copies),
which alone kept the bench under 40 fps; it now draws in bands on four
threads, which the memory bandwidth limits anyway.
Tests: a BGRx and an RGBx picture through the GPU match the CPU's
conversion (40.4 dB at full size, 48.7 at half), and a streamer on the
test pattern in memory with two `h264_vaapi` layers sends every frame
through the GPU and decodes in the right colours (a red-blue swap fails
it). The bench's GPU count now covers both kinds of frame.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings the negotiation work (voelin-stream: mDNS candidates, relays,
Chromium offers) and it-smoke waiting for clients instead of fixed
pauses, before the final checks of the identity default work. No
conflicts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The user wants to appear as their TeamSpeak identity. Until now the
official client's default became Voelin's only on a store without
identities, so anyone who had started Voelin once kept the identity the
app had created on its own, which nobody chose.
The store now records where each identity came from and which one is
the default (schema 4: identities.origin created/imported/user and
is_default; the migration marks the first identity named Default as
created, the rest as imported, the first as the default). When the
import on start finds the official client's default while Voelin's
default is still the created one, that identity becomes the default,
once: the created one is kept, and choosing it again later makes it the
user's own, which no import replaces. The status says so ("You now use
your TeamSpeak identity "X"; your previous one is kept").
The toast wrapped nothing and was cut at 560 pixels, wider than a phone;
it now wraps within the window. voelinctl identity list shows the origin
and the default. Tested with synthetic databases and in the app headless
with a fake home: created, then replaced once, then left alone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test pattern's DMA-BUFs came from /dev/udmabuf: ordinary memory,
which the GPU reads over the bus. Measured on the Radeon RX 7900 GRE
(`gpu_conversion_cost`, new, ignored): converting a 3840x2160 RGB buffer
to NV12 took 9.7 ms from such a buffer against 0.16 ms from one in video
memory in the driver's tiled layout, and 4.0 against 0.09 ms at 1080p;
the import itself costs 0.01-0.02 ms either way. So the bench showed the
GPU path at 4K240 stuck at 70 fps waiting for the bus, which no real
capture does. udmabuf also refuses buffers over 64 MiB, so 7680x4320
(132 MiB) could not be benched on the GPU path at all.
`SyntheticScreen::with_video_memory` (`StreamerConfig::
synthetic_video_memory`, `voelinctl stream bench --vram`) draws eight
frames of the pattern in advance into VA-API surfaces of the driver's
layout, exported as DMA-BUFs and handed over in turn, as a compositor
hands over the screen; a sink that declines them gets memory frames as
before. The exported surface was a test helper and is now crate code
(`ffmpeg::Exported`). With it, from a dev build: 4K240 AV1 at 60 Mbit/s
236.8 fps with 0.31 ms on the GPU per frame and 0.03 cores; 8K60 60.0 fps,
1.01 ms, 0.01 cores, the encoder's 16.5 ms per frame the limit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bitrate was a fixed 8 Mbit/s by default whatever was shared, and the
share dialog offered at most 10 Mbit/s and 60 fps. Asked for: Voelin
streams that can target 60 Mbit/s at up to 8K and 320 fps, with an
automatic bitrate that scales with the stream's resolution and frame rate
and follows it live, beyond 60 Mbit/s only when typed.
- `media::auto_bitrate(width, height, fps)`: 0.12 bits per pixel and
frame (7.5 Mbit/s at 1080p30, 15 at 1080p60, 27 at 1440p60) between
300 kbit/s and 60 Mbit/s, reached at 4K60 and 1080p240.
- `stream.bitrate_kbps` 0 is automatic and now the default. A streamer
layer with bitrate 0 works it out per picture from the size encoded and
the layer's frame rate, so a new resolution or frame rate moves it at
once, and tells its sink (`MediaSink::auto_bitrate`). The engine's
`StreamSink` puts it into the live stream's layer, so connections start
their bandwidth estimate at it and probe for it; without that the
stream would have kept the bitrate announced at the start.
`Streamer::bitrate_kbps()` is what to announce.
- The quick share offers 15-320 fps and Auto, 2.5 to 60 Mbit/s (typed
values still have no maximum; the `ui` blob keeps indices of the old
lists for older versions). The studio offers 4K and 8K and 30-240 fps,
takes an empty bitrate as automatic and derives its first simulcast
layer from the automatic bitrate.
- The studio now tells the engine its layers when it goes live and when
they change (`SetStreamLayers`), and a quick share resets them: the
session sends only layers it knows of, so a studio's simulcast layers
never reached a viewer, and its layer kept the bitrate announced.
- `voelinctl stream start` and `stream bench` default to the automatic
bitrate too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The development branch gained FFmpeg's decoders and the decoder ladder.
Conflicts only in text: the changelog keeps both entries, media.md the
H.264 profile ladder next to the new VideoPipeline description, the
interop README both sets of Chromium findings, and browser_codecs.rs
both the per-format viewer sink and the new pipeline test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The conflicts were in the app: the settings a running window follows (the
quick share's audio sources, now also the decoder settings) and the
imports of video.rs; both keep both sides.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The base moved on (the phone and Android wave, the quick share's sound,
voelinctl subscribing to every channel); it merges without conflicts
and the negotiation changes build and pass on top of it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The report has the decoders now: print them like the encoders, with
their self-test results and rank, and the order a viewer tries each
codec's decoders in. --decoder and --no-hardware-decoding rank them as
the settings stream.decoder_backend and stream.hardware_decoding would.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A watched stream now decodes with the best decoder of its codec and,
when it fails, with the next of the codec's ladder, without ending the
watch: three failures in a row (errors, or ten frames without a picture)
replace it, the keyframe that failed starts the next one at once, and
otherwise a keyframe is asked for. Each switch is logged with its reason,
and DecodeStats tells the decoder in use.
The official client's H.264 has B-frames and rare keyframes, and the
pipeline dropped every frame after a loss or an error until the next
keyframe, which such an encoder seldom sends. Decoders that conceal what
a loss leaves missing (FFmpeg's H.264 and HEVC) now go on decoding while
a keyframe is asked for; the others still skip to it. Whenever one is
wanted it is asked for again every half second until it comes, also
while no frame arrives, instead of once per skipped frame.
Pictures come from a small pool and go to the callback as
Arc<VideoFrame>: decoders write into a free one (decode_into), and a
consumer that converts and drops each picture, as the app does, costs no
allocations.
Settings stream.hardware_decoding and stream.decoder_backend choose the
decoders like the encoder settings (decoder_preference); the app applies
them when they change, to streams watched from then on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A streamer offered H.264 only in Constrained High, which peers whose
decoders list no High profile (headless Chromium's libwebrtc, many other
WebRTC stacks) cannot answer, so an H.264 stream had no way to reach them.
The offer now lists both profiles, best first (PT 112 Constrained High,
PT 108 Constrained Baseline, at the level the stream needs). The answer's
payload type tells the streamer which one the viewer took
(PeerEvent::VideoCodec now carries a VideoFormat: the codec, and H.264
with its profile). The streamer already ran one encoder per codec viewers
chose; it now runs one per format, so a Baseline viewer gets frames from
an encoder in Constrained Baseline, and frames go only to viewers of
their format (LayerFeedback has a bit for it).
voelinctl's FrameSource path offers Constrained High alone, as it cannot
encode per viewer. The browser test now offers the ladder and checks the
SPS profile of what it sent against what the browser chose.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The new smoke step (a viewer in the default channel watching a stream in
another channel) failed: `voelinctl stream watch` waited forever. Unlike
the app's engine and voelinctl's tree and repl, the stream commands never
subscribed to the other channels, and the server shows a client, and so
its streaming flag, only in subscribed channels; discovery never learned
there was a stream to look up. They now subscribe to every channel on
start, as the engine does.
Checked on the TS6 dev server: a viewer in the default channel received
and decoded 60 pictures (1280x720) of a stream in `smoke-elsewhere`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Classic RTMP carries H.264 only, and the RTMP output refused a stream
encoding anything else. Since TeamSpeak streams now prefer the codecs
every client decodes before H.264, that refusal hit the usual case.
An output may now name a video codec of its own. The streamer then runs
an encoder of that codec for the layer the output takes, as it does for
a viewer that chose another codec, and hands those packets to the
outputs that asked for it only; recordings and the replay buffer keep
the stream's codec, which a studio now always encodes for them even
when every viewer chose another one. Only the output's layer gets the
extra encoder, not every simulcast layer.
Tested end to end: a VP8 studio stream pushed to FFmpeg's own RTMP
server arrives as H.264 and AAC (ffprobe), starting at a keyframe, while
a recording of the same stream stays VP8 and Opus.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The streamer chose each viewer's layer from its bandwidth estimate, and a
viewer could neither see which layers there were nor ask for one: the watch
screen's quality picker only asked for a keyframe.
A Voelin streamer with several layers now lists them in its offer, in a
session-level SDP attribute, `a=x-voelin-layers:<id>/<WxH or
scale>/<bitrate>[/<fps>] ...`, added to the SDP str0m makes (peer.rs is
untouched). A Voelin viewer reports them (WatchEvent::Layers,
Event::WatchLayers) and asks for one with Command::SetWatchLayer, which
sends `{"cmd":"x-voelin-layer","args":{"layer":<id or null>}}` through
streamsignaling. The streamer moves that viewer to the layer at its next
keyframe and keeps it there whatever the estimate says, without letting it
lower the layer's bitrate for everyone else; null ("Auto") hands the
choice back to the estimate. The watch screen's picker now drives it.
Official clients are not affected. libwebrtc skips session attributes it
does not know: headless Chromium 152 answers an offer carrying the line
and decodes as before (browser interop test, which now sends it). A viewer
sends the request only to a streamer whose offer had the attribute, and
only Voelin streamers add it, so official streamers never get the signal;
which codecs are offered does not change.
Tests: two sessions with peers on loopback switch the viewer to layer 1
and back on request; a streamer whose offer lists no layers is never
asked; the attribute round-trips. Through the TeamSpeak 6 dev server,
`voelinctl stream watch --layer 1` against a two-layer placeholder stream
kept the viewer on layer 1 at an estimate that fits layer 0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The streams list and the watch screen showed how many watch a stream only
when a gateway's directory knew it, although TeamSpeak 6 tells the count
itself: `viewer` in `notifystreaminfo`.
StreamInfo gets `viewers`: the server's count from `notifystreaminfo`, 0
for a stream that just started. Probed on the dev server, the server sends
`notifystreamclientjoined` to the whole channel but `notifystreamclientleft`
only to the streamer and the viewer who left, and no `notifystreamupdated`
for either; so the directory counts joins and leaves itself and the engine
asks `requeststreaminfo` again, one stream of another client every 5 s
round robin, which corrects the leaves it was not told about without
flooding the server however many stream. The app shows that count, and the
gateway's where the server gave none; `voelinctl stream list` prints it.
Against the TeamSpeak 6 dev server, a late `stream list` printed
"1 watching" while a viewer watched and "0 watching" after it left.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The RTMP output was a seam that refused every rtmp:// URL. Broadcast
services (Twitch, YouTube, nginx-rtmp) take RTMP, so the studio could only
reach the few that speak WHIP.
The connection is libavformat's own rtmp:// and rtmps:// protocols,
loaded at runtime with the rest of FFmpeg and never linked. Its RTMP
writer takes an FLV byte stream and sends each tag as a message, so the
FLV is ours (onMetaData, AVC and AAC sequence headers, a tag per frame)
and no muxer struct (AVFormatContext, AVStream, codec parameters, which
all moved between releases) is used: five avio functions and
AVIOInterruptCB. Write errors only land in AVIOContext.error, which moved
too (120 bytes in libavformat 58, 84 in 63); it is found at load by
flushing a context whose write callback fails with a sentinel.
Video is the studio's H.264 of one layer as encoded; other codecs are
refused with the reason. Audio is the studio's Opus decoded and encoded
as AAC-LC by FFmpeg's own codecs on the output's thread. The encoder's
sample format has no AVOption, so AVCodecContext.sample_fmt is located
from its neighbours' option offsets like hw_frames_ctx; its 1024-sample
frames are a reference to the first decoded frame (FFmpeg filled in the
channel layout, whose field moved) with only the leading fields pointed
at our planes.
The stream key comes from the URL or the token (sent as the play path)
and never shows in the output's name. The first connection is made when
the output is added, so a wrong address fails there; later failures are
reconnected with backoff (1 s doubling to 30 s), each new connection
starting at a keyframe it asks for, and the stats show why it is down.
EndStream unpublishes; a dead network is cut off after three seconds.
Tested against FFmpeg's own RTMP server (ffmpeg -listen 1): a studio
stream through the hardware H.264 encoder and a 440 Hz tone arrives as
h264 320x180 and aac 48 kHz stereo per ffprobe, starts at a keyframe,
decodes, and comes back after the server is replaced; the unit tests
also pass against FFmpeg 4.4.8. voelinctl studio run gets --rtmp.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The streamer's sink never took DMA-BUFs, so every captured frame was
read by the CPU, converted to I420 on every core and uploaded again for
a VA-API encoder; on a discrete GPU reading the buffer alone cost 19.5
cores at 1440p60 until the portal fell back to shared memory.
Ingest now takes DMA-BUFs whenever every encoder of every layer takes
GPU frames: on the capture thread one GpuConverter call converts the
buffer to NV12 and scales it for each layer that is due, straight into
surfaces of our own, and returns once the GPU is done, so the buffer goes
back to the compositor at once. Each layer's frame travels through a
second handoff to its encoder thread, which waits on both inboxes and
encodes the surface as it is (encode_gpu). The CPU path stays as it was
for everything else, and the capture switches to it by itself:
- an encoder that needs frames in memory (libvpx, x264, or an encoder
made for a viewer of another codec) sets its layer's GPU alignment to
0, so Ingest declines the next DMA-BUF and the portal maps it; until
then such an encoder skips GPU frames and starts with a keyframe;
- a conversion that fails turns the GPU stage off for the capture, with
the reason in StreamerStats::gpu_error.
Each layer's encoders publish the largest alignment they need, so the
GPU makes frames at sizes they encode exactly (AV1 on RDNA3 included).
A still screen's last GPU picture is sent again with a new timestamp
through another reference to its surface (GpuFrame::at).
StreamerStats gains gpu_frames, gpu_convert_time and gpu_error, and
`voelinctl stream bench` prints both paths; its new --dmabuf hands the
test pattern over as DMA-BUFs (StreamerConfig::synthetic_dmabuf), which
drives this path without a portal. Measured there (debug build, 720p30,
h264_vaapi): every frame on the GPU, 0.90 ms per frame on the capture
thread, 0.02 cores for the whole process.
Test: two simulcast layers through h264_vaapi take the GPU path for every
frame at their own sizes; a switch to libvpx takes the CPU path again
and the stream decodes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Measured on a real RX 7900 GRE with FFmpeg 9: VA-API and AMF encode
1080p60 and 1440p60 at a quarter to half a core, simulcast included;
RGB DMA-BUFs are converted to NV12 on the GPU; Wayland screen capture
delivers frames again (it delivered none) and switches to shared memory
where reading GPU memory is slow; the H.264 level of the SPS matches
the offer; AV1 is cropped to what this GPU really encodes; FFmpeg 9's
structure offsets are checked against its headers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a machine with hardware encoders, voelinctl's streamer chose H.264
(the first hardware codec) and, sending through a FrameSource, offered
it alone. A viewer that cannot decode H.264 (no OpenH264 library)
answered with a video section that listed no payload type at all; the
streamer could not parse that answer and dropped the viewer, which only
saw "removed by the streamer (Failed)".
A viewer now refuses such an offer with the codecs on both sides, and
voelinctl's single-codec offer defaults to VP8, which every client
decodes; --codec or a named --encoder still pick another. The engine's
own streams are unaffected: they offer several codecs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The studio's pieces are tested one by one, but nothing could run a whole
scene file the way the app will. `voelinctl studio run <scenes.json>`
starts the studio from the JSON of the studio.scenes setting, encodes its
composite with the streamer as a stream would, and does any of: save the
last preview picture, record, keep a replay buffer and save it as a clip,
push to a WHIP endpoint, switch scenes halfway (live, while recording).
`studio bench` composites N sources (a 4K screen scaled down, a mirrored
and cropped camera, an image with alpha, text, then again) at the output
size and rate with no encoder, and prints the compose time and the heap
allocations per frame, counted by the process allocator that `stream
bench` already uses: 0 per frame at 1080p60 with 4 and with 16 sources.
`studio cameras` lists what a camera source can name.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Measured on a real 2560x1440 Wayland desktop through the ScreenCast portal,
which nothing here had ever run against: every captured frame was dropped
and the viewer got nothing.
Two faults, one behind the other.
The mapping length came from `mapoffset + maxsize`. Those describe a
mapping, which only shared memory has; a DMA-BUF's size lives in its buffer
object, and this compositor leaves both fields 0 (the file descriptor and
the 10240-byte stride were fine). The length was therefore 0, every map was
refused, and the capture delivered nothing for as long as it ran. Derive the
length from the rows the negotiated format describes, which is exactly what
is read afterwards.
With frames flowing, the second fault showed: reading a LINEAR DMA-BUF from
this GPU's memory took 11.95 ms per frame and 19.5 CPU cores at 1440p60,
against 0.27 ms and 0.41 cores for the same capture over shared memory — 44
times the time, 48 times the CPU. The guard that exists for this switches at
6.0 ns per pixel and the DMA-BUF path only reaches 3.24, so it never fired.
Put the threshold between the two measurements, an order of magnitude above
the shared-memory figure so a GPU whose buffers the CPU can read keeps them.
After both: 2560x1440 at 60.0 fps on 0.55 cores, no dropped frames, the
bitrate honoured. A DMA-BUF that cannot be mapped at all now also falls back
to shared memory after a few failures instead of dropping frames forever.
`stream bench` was reporting the layer size from --res, which is not what a
real source encodes; it now prints the size that was really encoded.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The bench only ever ran the synthetic pattern, so the pipeline was never
measured on the source the user actually complains about: a Wayland desktop
through the ScreenCast portal.
Add --source (synthetic, portal, monitor:<n>, window:<id>). Because the
portal asks the user in a dialog and never answers on its own, the start and
the wait for the first frame both have a deadline (--start-timeout, 60 s by
default) and fail with a plain message instead of hanging; the real captured
size is printed once frames arrive.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Import and export have to be reachable before the Profiles screen exists, and
a headless command is also how the round trip gets tested against a real
client installation without any of its data entering the repository.
The listing prints nothing but the nickname, the unique id and the security
level: all three are public — servers see them — while everything else in an
identity is the private key. `--dry-run` reads and stores nothing. `list`
comes along because `export <id>` is unusable without a way to learn the id.
Prove the imported key pair is whole rather than merely parseable: the
clients' format carries the public point next to the private scalar and
`Identity` keeps only the scalar, so signing a nonce and verifying it with the
key derived from that scalar shows the two halves belong together. The same
check runs over a real database when `VOELIN_IDENTITY_IMPORT_CHECK` points at
one, which keeps that verification repeatable without committing a fixture
that could only come from someone's own identities.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
H.264, HEVC, AV1, VP9 and VP8 on VA-API, NVENC, Quick Sync, AMF, Media
Foundation, VideoToolbox and the software encoders the system FFmpeg
has, found at runtime without a version allow-list and self-tested per
backend. Viewers get the codec they answered, with one encoder per codec
only while someone needs it, and H.264's level follows the stream.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
`voelinctl stream encoders` prints the FFmpeg libraries found, every
encoder backend with its self-test result or why it cannot be used, and
the order the streamer tries them in (--encoder / --no-hardware rank as
the settings would). `stream bench` and `stream start` take --encoder,
--no-hardware and a --codec that defaults to the named encoder's codec
or the choice's first; they print the backend in use. `stream start`
feeds a FrameSource, which does not tell codecs apart, so it offers its
stream codec alone; with the test pattern the H.264 level follows its
size, rate and bitrate.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
messageadd carries the recipient's unique id as bytes (base64 on the
wire); the engine passed the base64 text itself, which the server
refused as an invalid client id.
voelinctl engine can now wait for an icon or a flagged poke (listen
--expect matches pokes, chat and icons), for a friend to be seen online
(contacts ls --expect-online), and identity show prints the unique id a
TeamSpeak 6 server knows the identity by (uid6), which offline messages
there need. Contacts commands wait for the stored contacts to load
instead of for an event they could miss.
Verified against 3.13.8 and 6.0.0-beta13.1: file upload, listing,
download, a chat link downloaded by another client, avatars (the a-p
file name on both), channel icons, pokes, private messages, offline
messages, friend presence and blocked pokes (flagged and hidden).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
Manual and smoke testing of the engine's voice features needs a driver:
`voelinctl engine <address> <action>` runs one engine voice session and
does files (ls, upload with an optional chat link, download, rm, mkdir,
mv), avatar (set, clear, wait for someone's and check its MD5), poke,
dm, offline (send, read with --expect and --delete), contacts (set, rm,
ls in --db) or listen (pokes, chat, file links, which it can download).
It prints one line per event and fails on errors or when time is up.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
Stream audio is mixed from any number of sources (desktop, chosen apps,
the shared window's app, the processed microphone), each with gain,
mute and meters, changeable while live. Desktop audio now leaves out
Voelin's own playback on Linux, Windows and Android.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
The streamer captured one audio source (system audio, or a tone with the
test pattern), so viewers also heard the voices we play back, and there
was no choice of what to share.
StreamerConfig::audio_sources now takes any number of AudioSourceSpec
(kind, gain, mute): DesktopWithoutSelf, App(name or pid), WindowAudio
(the shared window's process, on X11 and Windows), Microphone (after
noise suppression, through the voelin-audio tap) and Synthetic. They feed
a StreamMixer whose thread encodes one Opus frame every 20 ms on the
monotonic clock, stamped with the block number, so the RTP time follows
real time across silences and stalls. Mixing goes on without a sink, so
source buffers keep moving.
StreamerConfigUpdate::audio_sources changes them live: kinds that stay
keep their capture and take the new gain and mute, new ones start,
removed ones stop, and an empty list leaves a silent track. A source that
cannot capture does not fail the stream; its error shows in
StreamerStats::audio_sources (with level, state, latency and underruns),
and in Streamer::audio_error, which now returns an owned String.
StreamerStats also carries the mix level and the limiter gain;
Streamer::audio_mixer gives the handle for lock-free meters, and
media::audio_apps lists the applications for a picker.
The settings key stream.audio_sources (JSON, default: desktop audio
without Voelin) stores the sources. The UI's share reads it, and an
empty list shares without sound. StreamAudio is boxed so a LocalPreview
held inline stays small.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
Chats show their stored history at once and sync what the gateway kept
while we were away; messages seen over voice and the gateway are
stored once. Pins, reactions, topics, events, the stream directory,
activity and gateway administration are engine commands and events.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
`voelinctl gateway --engine` runs one engine session against a gateway,
optionally with voice, and prints every history batch, gateway update
and stream event as a line: --chat opens chats (with --db, stored
history), --older pages back, --request sends any gateway request as
JSON (admin config, permission rules, events, ...), --roundtrip posts,
pins, reacts, starts a topic from the post, posts into it and reads it
back, --stream-seconds streams synthetic frames (registering in the
directory) and --watch-streamer watches a stream once found.
it-smoke adds three steps with the gateway running: messages sent while a
user is offline reach its stored history on the next connect (the admin
sets relay.pinned_channels at runtime for it); the pin/react/topic round
trip as a normal user with a permission rule the admin sets; and on
TeamSpeak 6 a stream registered in the directory found and watched by a
viewer that connects later. The gateway's port can be moved
(TSGW_PORT_TS3/TS6), and default builds go to $CARGO_TARGET_DIR.
A chat's first stored page is no longer marked complete while its
gateway is still connecting.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
Capture, conversion and encoding on their own threads with latest-wins
handoffs and frame pools, one encoder per simulcast layer, portal
DMA-BUF, a wlroots capture backend, tuned libvpx, per-stage statistics,
Streamer::reconfigure and voelinctl stream bench. Conflicts: the root
manifest (dimpl patch next to the release profile) and voelinctl's
command list (probe-stream next to the stream tools).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
The streamer converted and encoded on one thread, one frame after the
other, with the frame rate clamped to 1..=60 and one encoder. It is now
a pipeline of threads connected by latest-wins handoffs:
capture thread (backend) ── convert + scale (pool of all cores)
── Handoff per layer ── encoder thread per layer ── MediaSink
- The capture backend calls the pipeline's `FrameSink` with the frame
still in its capture buffer. Frames beyond the frame-rate cap are
skipped before anything is read. The `Pyramid` converts the frame once
and derives every due layer's size (`LayerSpec::output_size`) from
the nearest larger one, in recycled frames.
- Each layer (`StreamerConfig::layers`; empty: one layer at
`bitrate_kbps`) has its own encoder thread and encoder, its share of
the CPUs, its own frame-rate cap (`max_fps`, paced by timestamps),
and gets the newest frame through a one-slot handoff; frames it was
too busy for are dropped and counted, never queued.
- Keyframes: `take_layer_keyframes` is polled by whichever encoder
thread gets to it and each requested layer is flagged, so exactly the
requested layers encode a keyframe (kept due until one is produced).
A still screen sends no frames, so a request is answered by encoding
the last picture again.
- Bitrate: every frame, each layer follows `layer_bitrate(id)` when the
sink knows it (capped by `max_bitrate`), else its configured bitrate;
libvpx changes it in place, without a keyframe.
- `Streamer::reconfigure(&codecs, StreamerConfigUpdate { fps,
bitrate_kbps, codec, layers })` applies from the next frame without
restarting the capture: new encoders are created first (errors change
nothing), layers keep their encoder when their id stays, new ids get
threads, removed ones stop, a codec change swaps every encoder (first
frame a keyframe), the frame-rate cap reaches the capture backend.
- No built-in limits: any fps >= 1, any bitrate, any size; threads from
the CPU count.
- `StreamerStats` gains capture fps, convert time, convert threads,
dropped frames, codec and per-layer `LayerStats` (size, frames,
keyframes, dropped, fps, kbit/s, encode time, target bitrate, threads,
encoder speed); counters are atomics, rates are computed once a second
by a stats thread, which logs a one-line summary every 5 s at debug
level. `StreamerStats` is no longer `Eq` (it has rates).
- `EncodedSource` answers `request_layer_keyframe`; the local preview
shows the first layer.
- In steady state nothing is allocated per frame between capture and
encoder; the one allocation per encoded frame is the `Arc<[u8]>` of
`EncodedFrame` (encoded sizes vary, so it cannot be recycled).
`voelinctl stream bench` prints the new per-stage and per-layer numbers
and allocations per captured and per encoded frame.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
Conflicts with the SRTP/BWE/simulcast work were in the engine's command
loop, session and stream tasks (both sides kept: SRTP order and layers
next to settings and discovery) and in the voelin-stream exports.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
Layer ids given by position were assigned after the placeholder source was
created, so its frames carried id 65535 and no viewer got video. Found
streaming placeholder layers through the TeamSpeak 6 dev server.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
Official TeamSpeak 6 clients use AES_CM_128_HMAC_SHA1_80, while our peers
negotiated AES-256-GCM. PeerConfig::srtp_profiles now sets the order (default
AES_CM_128_HMAC_SHA1_80, then the GCM profiles for peers without it); a
DTLS provider wrapping str0m's dimpl DTLS applies it and records the
negotiated profile. It can be changed at runtime (Streams::set_srtp_profiles,
Command::SetSrtpProfiles) for new connections.
Streamer peers now run str0m's bandwidth estimation and pacer. Each viewer
gets the simulcast layer its estimate allows (down at once, up after 2 s
above the next layer's minimum plus 20%), switching at a keyframe of the new
layer, which is requested. Keyframe requests and bitrate targets (lowest
estimate of a layer's viewers) are per layer and reach the encoders
lock-free through LayerFeedback (StreamSink::take_layer_keyframes,
layer_bitrate). Peers that negotiate RID simulcast (PeerConfig::simulcast,
for SFUs/WHIP) get every layer with its RID. Layers can change while live.
voelinctl stream start takes --layer, --simulcast, --srtp and --placeholder
(layered synthetic frames without an encoder) and prints each viewer's
layer, estimate and SRTP profile.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
The server announces a stream (notifystreamstarted) only to the clients in
the streamer's channel when it starts. A client that connects or enters the
channel later saw the streamer's client_is_streaming flag but could not
watch. The probe (docs/research/ts6-late-join.md) found that
`requeststreaminfo clid=<streamer>` answers with notifystreaminfo, one part
per stream of the client, from any channel.
voelin-stream gets a discovery module. Streams::update_clients takes the
clients on the server (channel and streaming flag), keeps the directory to
the streams in our channel, and looks up the streams of streamers in our
channel we were not told about: after connecting, after we or they change
channels, and when an announcement did not come. The answer fills the
directory like an announcement, so Event::StreamsChanged lists the stream
and it is watched like any other. Where streams are looked up is a
StreamLookup trait (the server now; a gateway directory can plug in with
Streams::add_lookup and report through Streams::discovered).
notifystreamupdated (updatestream) now updates the directory.
The engine and `voelinctl stream list/watch` feed the client list in. The
declarations learn the notifystreaminfo answer's fields, notifystreamupdated
and requeststreaminfo. Tests: a fake-server session test and an engine live
test with a viewer that arrives after the stream is live, discovery unit
tests, parsing of the server's answers; it-smoke gets a late-viewer step.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
The server announces a stream only to the clients in the streamer's channel
when it starts; clients that arrive later see only client_is_streaming. To
find out what the server offers instead, probe-stream runs two clients:
A creates a channel and starts a stream, B arrives afterwards and tries
candidate commands from another channel and from A's channel
(requeststreaminfo spellings, clientgetvariables, clientinfo, list-like
command names, joinstreamrequest with the learned id), A tries updatestream
and client_meta_data. Every command both clients exchange is printed raw
through a listener on the tsproto connection (tsclientlib's unstable API),
so notifications the declarations do not know yet show up too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
`voelinctl stream bench [--res WxH] [--fps N] [--codec vp8|vp9|h264]
[--layer SPEC ...] [--seconds N]` runs the streamer's real pipeline on the
test pattern without a server, into a sink that counts frames, keyframes
and bytes per layer, and prints frame and bit rates, CPU use and heap
allocations per frame in the steady state. Allocations are counted by a
global allocator in voelinctl only (one relaxed atomic add each).
The flat test pattern costs an encoder next to nothing, so it cannot show
how the pipeline copes with real screens. `Pattern::Desktop` looks like a
desktop with a code editor (gradient title bar, side bar, coloured lines
of text) whose document scrolls three pixels per frame; it is rendered
once and copied per frame, so drawing it stays cheap. The bench uses it by
default (`--pattern simple` for the old one); `StreamerConfig` gets
`synthetic_pattern`. Drawing the pattern now reuses a buffer
(`SyntheticScreen::render`) and fills rows by copying.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
LayerSpec describes one encoding (size or scale, fps cap, bitrate range,
minimum estimate, RID); LayerSet is a growable set of layers. Encoded
frames carry their layer, FrameSource and MediaSink gain per-layer
keyframe requests and bitrate targets, and StreamerOptions and
StreamerConfig take the layer list. Behaviour is unchanged: one layer, 0.
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
`media` uses whatever tsc-media backends are enabled (MediaCodec and a
registered capture source on Android); `media-desktop` adds tsc-media's
default backends (libvpx, OpenH264, X11, PipeWire). The default features
no longer include media, so crates that depend on tsc-core with defaults
do not pull libvpx into Android builds.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
`stream start` captures through tsc-core's Streamer: `--synthetic` (or
`--source synthetic`) is the moving test pattern with a tone, `--source
x11[:N]`, `screen[:N]`, `window:<id>` or `portal` capture the desktop,
`--bitrate` sets the encoder and setupstream. `stream watch` decodes the
video, counts decoded pictures for `--expect-frames` and can save the
last one with `--save-frame out.png`. Offers carry the codec we encode
and answers accept what we decode.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
tsctl connect <addr> stream [--loopback|--stun X|--no-stun]
start --synthetic [--name] [--auto-accept] [--seconds N] [--fps]
[--frame-size] [--no-audio]
Streams SyntheticSource frames through tsc-stream's sessions.
Without --auto-accept, join requests are answered on stdin
(accept/deny/kick <clid>, stop). frame_source() is the seam for
real capture and encoders.
list Streams announced in our channel, plus clients whose
client_is_streaming is set but whose stream id we were not told.
watch [--id] [--streamer-nick] [--expect-frames N] [--timeout S]
Joins the matching stream (or the first one); exits 0 once N video
frames arrived.
it-smoke.sh (TS6 only): a viewer waits for a uniquely named streamer,
which then streams 10 s of synthetic VP8 + Opus over loopback; also runs
the engine's stream_live test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G