65 Commits
Author SHA1 Message Date
Claude 47f5e2d9aa review: fix what the review of the gateway, avatar and banner changes found
- voelinctl observes with the new gateway list and checks avatar hashes
  only when they are MD5s (a myTeamSpeak avatar's hash is its link).
- Gateway discovery keeps to the most specific name that publishes a
  record; another server's gateway is no fallback. The admin guide says so.
- The observer's resync keeps the avatars clientlist does not tell
  (they come with the enter and update notifications).
- A server avatar given up on counts for that picture only: a new one is
  tried again, and one that arrives after all is shown again.
- updatemytsdata goes again after tsclientlib reconnects (the server
  forgets it), and once, not twice, when signing in.
- SVG is told by its prolog: a page with an svg in it (HTML, XHTML) is a
  page, refused and logged as one; the UI tells it the same way.
- Cursors (CUR) are no longer taken for pictures; MP4 and MOV are named
  videos, not AVIF.
- The UI decodes at most 128 MiB of pixels on its thread, drops the full
  picture before copying the small one, logs what it cannot decode, and
  remembers pictures it cannot show instead of decoding them on every
  refresh; a banner that reloads unchanged is not decoded again.
- The early refusal of a long error page is tested again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VZBWxxMsxUzp4PSTKVzbZN
2026-10-05 23:09:34 +00:00
Claude 219e554efe versions: claim the newest signed TeamSpeak 6 build; 122 more rows
Versions.csv gains the 121 verified rows of upstream tsdeclarations it was
missing (TeamSpeak 5 betas, 3.6.x) and 6.0.0-beta4.1 [Build: 1779880475]
for Linux, captured from the official Linux client's clientinit. Every row
verifies against TeamSpeak's version-signing key. They are appended, so
the generated Version variants and the indexes keep their names.

native_version() now claims the newest 6.x build signed for the native
platform (Linux 6.0.0-beta4.1, Windows 6.0.0-beta2), so the client shows
as a TeamSpeak 6 client instead of 3.?.?; platforms without one (macOS,
Android, iOS) keep the generic tuple. --client-version generic (and a
bookmark's client_version) claims the old tuple.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VZBWxxMsxUzp4PSTKVzbZN
2026-10-04 21:26:15 +00:00
Claude 9db6937489 Merge branch 'codex/myteamspeak-account': myTeamSpeak account sign-in
Conflicts with the channel banners on main, both kept:
- crates/proto/UPSTREAM.md: myTeamSpeak's local patch is number 14, after
  the channel banners' 13.
- voelin-core/src/voice.rs: both test modules.
- ui/app.slint: the mobile shell hides behind the account prompt and keeps
  the channel chat's banner.
- ui/shells/common.slint: the user card counts a signed-in account as named
  and shows our avatar, the person icon only without one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEpqsPES27Eacue91u3d2Q
2026-10-04 17:55:31 +00:00
faumaray 24acc1910a account
Signed-off-by: Faumaray <faumaray@gmail.com>
2026-10-04 19:11:37 +03:00
selikhov 6e59ac93d9 Merge branch 'claude/gifted-lovelace-1crlx2' into worktree-agent-a3369fb4a9337b614 2026-10-04 14:14:56 +03:00
selikhovandClaude Opus 5.5 1318a9db3b Fetch banners from the web into the image cache
The host banner (virtualserver_hostbanner_gfx_url) and TeamSpeak 6
channel banners are http(s) addresses on any host, not files on the
server, so the voice file transfer that fetches avatars and icons cannot
get them. A new engine path (web.rs) downloads them with the workspace's
reqwest client (rustls, system proxies and certificate store) into the
same cache, keyed by the MD5 of the address (pictures/<md5>), only for
http and https, at most 4 MiB, with a 10 s connect and 30 s overall
timeout, and keeps a download only if its content is a picture the UI
decodes (PNG, JPEG, GIF, WebP, SVG), whatever the address or the server
say; an error page is not cached as a banner.

The session fetches the banners of the presence it shows, from any
source, when cache.fetch_images allows (it contacts hosts the server
chose, as the official client does), and reports each as PictureReady.
When the server sets virtualserver_hostbanner_gfx_interval, a timer asks
the session to fetch the host banner again (never more often than once a
minute, as TeamSpeak 3 and 6 servers enforce) and the new file replaces
the old one; Cache::fetch takes `fresh` for that.

Tests: a local HTTP server on 127.0.0.1 for the download, the size cap
(announced and unannounced), refused pages and the cache; the cache keys;
a live test that sets both banners on the TeamSpeak 6 dev server through
ServerQuery, sees them arrive and puts the server back. voelinctl engine
prints the pictures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 14:12:34 +03:00
selikhovandClaude Opus 5.5 adf958f0d0 voelinctl: stream statistics, the desktop pattern and no BWE for measuring
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>
2026-10-04 10:03:35 +03:00
selikhov 608bd2fbf2 Merge branch 'claude/gifted-lovelace-1crlx2' into worktree-agent-a5ecbed1e5dd55ddc 2026-10-04 09:28:11 +03:00
selikhovandClaude Opus 5.5 df4f534022 Streamer: convert pictures in memory on the GPU too, for VA-API encoders
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>
2026-10-04 09:13:32 +03:00
selikhovandClaude Opus 5.5 dde624257a Merge the development branch: stream negotiation, it-smoke readiness
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>
2026-10-04 04:50:57 +03:00
selikhov 92344651ca Merge branch 'claude/gifted-lovelace-1crlx2' into worktree-agent-a5ecbed1e5dd55ddc
# Conflicts:
#	tools/voelinctl/src/stream.rs
2026-10-04 04:48:34 +03:00
selikhovandClaude Opus 5.5 020b43a94e Use the TeamSpeak identity instead of the one Voelin made itself
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>
2026-10-04 04:25:42 +03:00
selikhovandClaude Opus 5.5 a6e163e9aa Bench the GPU path from buffers in video memory, as a compositor's are
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>
2026-10-04 04:18:53 +03:00
selikhov a2333c8223 Merge branch 'claude/gifted-lovelace-1crlx2' into worktree-agent-a5ecbed1e5dd55ddc 2026-10-04 03:58:05 +03:00
selikhovandClaude Opus 5.5 8917f7dab2 Streams: an automatic bitrate up to 60 Mbit/s, and presets to match
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>
2026-10-04 03:37:08 +03:00
selikhovandClaude Opus 5.5 a1d6c6f8aa Merge claude/gifted-lovelace-1crlx2 (the decoders) into the negotiation work
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>
2026-10-04 03:20:17 +03:00
selikhovandClaude Opus 5.5 65d0a3abf6 Merge claude/gifted-lovelace-1crlx2: Wave 5B (Android, phone, quick share's sound)
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>
2026-10-03 23:26:17 +03:00
selikhovandClaude Opus 5.5 d7940f846a Merge claude/gifted-lovelace-1crlx2 (Wave 5B) into the negotiation work
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>
2026-10-03 23:25:00 +03:00
selikhovandClaude Opus 5.5 200b715b9e voelinctl stream encoders: list the decoders and each codec's ladder
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>
2026-10-03 23:15:36 +03:00
selikhovandClaude Opus 5.5 289e7d4e6b Fall back to the next decoder at runtime; recover from losses
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>
2026-10-03 23:02:48 +03:00
selikhovandClaude Opus 5.5 9b20da22d8 Offer H.264 in Constrained High, then Constrained Baseline
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>
2026-10-03 22:45:58 +03:00
selikhovandClaude Opus 5.5 228ba1a62b voelinctl: subscribe to every channel for stream list and watch
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>
2026-10-03 22:27:35 +03:00
selikhovandClaude Opus 5.5 ecc132f5ff Push a studio stream of any codec over RTMP, in H.264
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>
2026-10-03 19:42:02 +03:00
selikhovandClaude Opus 5.5 8d14b0d5be Let a viewer pick the simulcast layer of a Voelin stream
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>
2026-10-03 18:10:17 +03:00
selikhovandClaude Opus 5.5 23bf7331c4 Show TeamSpeak 6's own viewer counts for streams
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>
2026-10-03 17:50:35 +03:00
selikhovandClaude Opus 5.5 2a1279ee7b voelin-media: RTMP output for the Stream Studio through libavformat
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>
2026-10-03 12:50:58 +03:00
selikhovandClaude Opus 5.5 f317153203 voelin-core: screen capture DMA-BUFs go to VA-API encoders on the GPU
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>
2026-10-03 07:47:47 +03:00
selikhovandClaude Opus 5.5 4e56c15505 Merge the GPU validation of the hardware video path
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>
2026-10-03 06:55:32 +03:00
selikhovandClaude Opus 5.5 1febc504c2 Refuse streams without a common codec; voelinctl streams VP8 by default
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>
2026-10-03 06:35:32 +03:00
selikhovandClaude Opus 5.5 4399933f5a voelinctl: run the studio headless, and bench its compositor
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>
2026-10-03 02:07:27 +03:00
selikhov 2b70cb9bf8 Merge branch 'worktree-agent-a7f9f51b4ced7cef7' into worktree-agent-a97633f32fc7a58c8 2026-10-03 01:43:37 +03:00
faumarayandClaude Opus 5 e5789e495e voelin-media: fix Wayland screen capture delivering no frames at all
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>
2026-09-29 23:50:52 +03:00
faumarayandClaude Opus 5 b566316b9f voelinctl: let stream bench measure a real screen capture
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>
2026-09-29 18:41:36 +03:00
faumarayandClaude Opus 5 04a8005679 Add voelinctl identity import, export and list
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>
2026-09-29 18:34:13 +03:00
Claude 5b36e27809 Merge video encoders through FFmpeg loaded at runtime
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
2026-09-29 06:11:26 +00:00
Claude 60a5ff7a68 Merge the stream audio mixer into the engine gaps branch
settings.rs: both sides added built-in keys; the list keeps the stream
audio sources and adds the cache, file transfer and privacy keys (20).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-29 01:00:34 +00:00
Claude 3ae804569a voelinctl: list the video encoders, bench and stream with any of them
`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
2026-09-29 00:56:41 +00:00
Claude aefe83d33a voelin-core: offline messages to the unique id's bytes; voelinctl checks
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
2026-09-29 00:51:41 +00:00
Claude 64775cd868 voelinctl: engine subcommand for files, avatars, pokes and messages
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
2026-09-29 00:37:00 +00:00
Claude 86db9c579e Merge the stream audio mixer and application audio sources
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
2026-09-28 19:49:51 +00:00
Claude 06c0dcc851 voelin-core: stream audio mixed from any number of sources
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
2026-09-28 12:49:52 +00:00
Claude 733f075515 Merge chat history and the gateway's features in the engine
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
2026-09-28 12:37:29 +00:00
Claude d4b2cab80c voelinctl, it-smoke: chat history, gateway features and the stream directory through the engine
`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
2026-09-28 02:55:29 +00:00
Claude 5efec8c568 Merge the faster screen-share pipeline
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
2026-09-28 02:21:24 +00:00
Claude 40ad426f26 Streamer: threaded simulcast pipeline, per-stage stats, reconfigure
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
2026-09-27 08:58:24 +00:00
Claude 6538734a6e Merge late-join stream discovery and the settings service
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
2026-09-27 08:58:21 +00:00
Claude f0f1269812 voelinctl: number layers before the source is built
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
2026-09-27 08:34:46 +00:00
Claude ede9c3941c Streams: SRTP profile order, bandwidth estimation, simulcast layers
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
2026-09-27 03:56:35 +00:00
Claude 90c23362ef Find TeamSpeak 6 streams that started before we joined
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
2026-09-27 03:41:20 +00:00
Claude 1fa6095a5f voelinctl: probe-stream, how a late TS6 client can find a running stream
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
2026-09-27 03:39:40 +00:00