VoiceOptions is a struct of its own, no longer an alias of the TeamSpeak
link's options: identity is an IdentityBlob and client_version a spec for
ts::versions::resolve, which rides the address as the link parameter
client_version and which the TeamSpeak connector resolves (a spec it refuses
fails the connect in words). SessionLink builds the connect parameters
(link/connect.rs: the bookmark's link, the hello, the credential of the
identity's kind, now also a Voelin key's signer) and session.rs holds it
directly: the ServerLink trait between them was redundant. The trait lives
on in the TeamSpeak module (ts/ts_link.rs, with the TeamSpeak-typed
ConnectOptions) for TsLink and the in-memory link of the tests.
ServerLink, TsLink, LinkCtx, LinkCmd, LinkEvent and Remote are crate-private,
Engine::start_with_link is gone, and the three tests that needed the inner
link (tests/link_fake.rs) are unit tests of link/ now. The rg over the crate
for tsclientlib, tsproto and voelin_query, outside ts/ and the three files
that use them privately (gateway.rs, query.rs, stream.rs), is empty. The UI
and voelinctl get compile fixes: the identity blob and the spec string.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Command::ObserveGateway.identity is a Box<IdentityBlob> (a TeamSpeak
identity as the key store keeps it; voelin_core::ts::identity::to_blob and
from_blob convert) and gateway::connect takes the blob too; gateway.rs reads
it itself, and one it cannot read ends the observation with its reason
instead of reaching the gateway. Command::ObserveQuery.connect is a
QueryLogin (transport, address, user, secret, server port and id) that
query.rs turns into voelin_query::Connect with the query crate's own line
options, which is what the UI always passed. voelin_core re-exports
IdentityBlob; voelin-identity is a dependency of voelin-core now, so
Cargo.lock gains that edge (the crate was in the graph already, and no
third-party package is added: THIRD_PARTY_NOTICES.md is unchanged).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ts_link.rs, voice.rs, book.rs, ts_session/, versions.rs and identity.rs move
under crates/voelin-core/src/ts (git mv, so git log --follow keeps their
history). voelin_core::versions and voelin_core::identity are
voelin_core::ts::versions and voelin_core::ts::identity now; the UI and
voelinctl follow with the new paths. Nothing else changes: the module
declarations, the use paths and the path of Versions.csv are the only
edits to the moved files.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
voelin-identity, voelin-proto and voelin-model now come from one revision of
the protocol repository (main c8e0e5a: the session seam voelin_proto::link
with its account types, and the replica in voelin-model). The client's own
crates/voelin-model is removed: the protocol's crate is a superset, identical
in presence, server, chat and percent, and differs in badges.rs, link.rs and
tree.rs only by a doc comment and two equivalent expressions, and adds the
perms and replica modules. Every crate that used it takes
voelin-model.workspace = true. voelin-core depends on voelin-proto (and, in
its dev-dependencies, on the test-util fakes), which the engine will consume
in the next commits.
Manifests, the lock file and docs only: no source change. THIRD_PARTY_NOTICES.md
is unchanged (scripts/notices.sh --check: up to date).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The stream-types commit shortened a let-chain in tools/voelinctl/src/engine.rs
that rustfmt 1.94 (the CI toolchain) lays out differently from nightly.
`cargo fmt --check` over scripts/own-crates.sh now passes on 1.94.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Command and Event no longer carry voelin-stream's types. voelin-core owns
StreamInfo, ViewerInfo, StreamSetup, StreamKind, ViewerState, EndReason and
LeaveReason (stream_types.rs) with u16 client ids, a viewer's SRTP profile
as its name and its codec as voelin_media::Codec; stream.rs converts at the
boundary. Command::SetSrtpProfiles takes profile names, which the stream
task parses.
EncodedFrame, LayerSpec, LayerId and LayerSet move into voelin-media
(stream::EncodedFrame, layer); voelin-stream depends on it and re-exports
them, so the engine, the stream sessions and voelinctl share one type. The
crate is now a plain dependency of voelin-core (feature media keeps the
module and WHIP), and its str0m feature is gone with str0m always there.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Event::ServerInfo carried voelin_model::ServerFlavor, a TeamSpeak notion. It
now carries backend: BackendInfo { product, version } (plain strings, with
label() for a sentence) next to the capabilities. The voice source decides
the flavor from the version string (voice.rs backend_of) and puts the
backend and capabilities in VoiceEvent::Connected; session.rs forwards them
and no longer classifies anything.
The UI reads backend.product for a server's chip (ServerItem.flavor becomes
product, as does the session view's field) and backend.label() for the
"Connected to ..." status line; the sample data builds its own backend and
the TeamSpeak 6 capabilities, pinned against the flavor's by a test.
voelinctl's engine mode prints the label. ServerFlavor stays in voelin-model
for the gateway and the voice source.
Shown text is unchanged. New tests: the voice source's backend for TS3, TS6
and an unrecognised version, BackendInfo::label, the status line, the sample
servers' backends, and the server item's product.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
voelin-audio no longer depends on tsclientlib or tsproto-packets. Its
boundary is now plain types in packet.rs: TalkerId, VoiceCodec, VoicePacket
(talker, seq, codec, whisper, payload) and EncodedVoice (codec, payload; an
empty payload ends the transmission). The jitter buffer moves from
tsclientlib::audio into jitter.rs and reads VoicePacket fields; the encoder
returns EncodedVoice and the mixer is keyed by TalkerId.
In voelin-core, voice.rs is the only place that wraps EncodedVoice into a
TeamSpeak audio packet and reads one into a VoicePacket (codecs other than
Opus are dropped there, where the jitter buffer rejected them before);
audio.rs and session.rs work on the new types. voelinctl converts at its
own edge. Behaviour is unchanged: the one-hour drift simulation gives the
same latencies as before.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- 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
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
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
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>
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