Commit Graph
189 Commits
Author SHA1 Message Date
selikhovandClaude Opus 5.5 6887cebb90 voelin-ui: lay out the Stream Studio screens
The studio gets its screens before its controller: scenes, sources, the
preview with LIVE, timer and viewers, the audio mixer, the stream chat,
the stream settings with the simulcast layers, the bottom bar and the
dialogs, arranged three ways (a page of the main window, a window of its
own, the phone layout). They read only the StudioBridge and StudioNav
globals, so the second window, which has globals of its own, shows the
same pieces once Rust fills both. A button in each top bar opens it.

Work in progress: nothing in Rust drives these globals yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 06:39:18 +03:00
selikhovandClaude Opus 5.5 3977071cb1 Merge the Stream Studio engine
Scenes of any number of sources (screen, window, camera, image, text,
colour) composited into pooled frames with no allocation per frame and
streamed through the existing encoders and simulcast; recording to
WebM/Matroska, a replay buffer that spills to disk, WHIP output, a
controller API with a preview tap for the Studio UI, studio.* settings,
and voelinctl studio run/bench/cameras. Background blur runs behind a
segmentation trait; no person-segmentation model is bundled yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:31:26 +03:00
selikhovandClaude Opus 5.5 7d7e26a397 voelin-media: say how the background mask is really sampled
The segment docs promised a bilinear, feathered mask; the frame path
samples the nearest mask pixel and relies on the mask's own soft edge.
Say so, here and in docs/studio.md, rather than promise a smoothing that
is not there: a model's sharper mask will want it, and that is the place
to add it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:29:15 +03:00
selikhovandClaude Opus 5.5 5291f86147 voelin-media: stop copying an image backdrop every frame
Replacing a camera's background with an image cloned the whole scaled
image (3.7 MB at 720p) for every frame, on the camera's thread, only to
mix it and drop it: the mix only needs to read it. The image path had no
test; one now checks the image shows behind the subject and the subject
stays as it was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:26:58 +03:00
selikhovandClaude Opus 5.5 d18f194c82 voelin-media: drop the unused v4l feature
The studio branch declared a `v4l` feature that nothing reads: cameras
are listed through V4L2 with the PipeWire feature and captured through
PipeWire. An empty feature only suggests a choice that does not exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:25:45 +03:00
selikhovandClaude Opus 5.5 8ac4575377 voelin-media: build the studio without the PipeWire feature
The camera list read V4L2 on any Linux build, but the ioctls go through
rustix, which only the capture features bring in: voelin-media without
default features (a core built with `media` alone) did not compile.
Devices are now listed where they can be captured, through PipeWire;
everywhere else the list is the test pattern. Checked with and without
default features, and for x86_64-pc-windows-gnu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:24:50 +03:00
selikhovandClaude Opus 5.5 e361156c70 Describe the Stream Studio in docs/studio.md
The studio had module docs but no page saying how its parts fit, what
the UI drives it with, which settings it keeps, and what is tested for
real against what only compiles. docs/studio.md covers the scene format
(with an example), the compositor and its numbers, cameras, background
replacement and the fact that no person segmentation model is in the
build yet, the outputs, the controller's commands and events and the
preview tap, the engine's hooks and settings keys, the voelinctl
commands, and the verification status. docs/media.md points to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:22:57 +03:00
selikhovandClaude Opus 5.5 f4fe3511f8 voelin-media: close the studio's pushing outputs when the stream ends
GoLive said it started the outputs that push and EndStream that it
stopped them, but both only changed the state: a WHIP output kept
pushing to the service after End Stream. WHIP outputs start when they are
added (that is when the service is asked), so GoLive now says just that,
and EndStream closes every output that pushes, reporting each removal;
recording and the replay buffer keep running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:22:41 +03:00
selikhovandClaude Opus 5.5 2a15f22313 voelin-media: restart a studio input only when it has to
Two rules said when a source's input restarts: the controller's own,
and SourceKind::same_input, which nothing called and which would have
kept a text source's old picture after its text changed. Now there is
one, same_input, and it also keeps a camera running when only its
mirroring changes: that is drawn by the compositor, and restarting the
camera for it meant a second of black while PipeWire renegotiated.

A WHIP output that drops a packet because its upload stalled now asks
for a keyframe, so the service's decoder recovers when the upload does
instead of showing a broken picture until somebody else asks.

The segmenter's input_size was never called (the frame path sizes the
segmenter's copy itself) and divided the height by the clamped width;
the trait now says what the segmenter is given.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:21:36 +03:00
selikhovandClaude Opus 5.5 b8b357a00a voelin-media: keep the audio of a recording's first moment
A recording and a clip start at a video keyframe, and dropped all audio
that came before it. But the video encoder is behind the audio: by the
time the keyframe of a moment arrives, the audio of that moment and of
the encoder's whole delay has already gone by. With a hardware H.264
encoder starting up, a recording's audio began 285 ms after its picture.

The recorder now keeps the last two seconds of audio while it waits and,
once the keyframe is written, writes the part not older than it. The
replay buffer keeps waiting audio the same way, and when it trims to a
keyframe it keeps the audio of the keyframe's time that arrived before
it; a clip feeds everything to a recorder, which skips video up to its
first keyframe. The same recording now starts its audio 10 ms after the
picture (one Opus frame).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:10:43 +03:00
selikhovandClaude Opus 5.5 805829e880 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
selikhovandClaude Opus 5.5 b048cacc82 voelin-core: stream the studio and keep its scenes in the settings
The studio composites, but nothing yet made its picture a stream or fed
its recording and replay buffer. Streamer::start_studio does both with the
smallest change to the streamer: the studio is one more capture backend,
and the packets the encoders already make are teed to the studio's outputs
where they are produced, with the frame size the recorder needs. Only the
stream codec's encoder is teed; a codec a viewer chose is never recorded.

Recording and the replay buffer must not need a live stream, so a studio's
streamer always has a sink: while no stream is attached it is one that
drops the frames after the tee. Its audio clock starts at the studio's
epoch, the clock the composite's timestamps already count from, so a
recording's audio and video start together (the test checks they do).

Outputs ask for keyframes of the layer they take only. The replay buffer
asks every two seconds while it is on: the encoders make keyframes only on
request, so without that the window could never move past the first one
and would grow for the whole session. WHIP asks once per need (start,
session up, the service's PLI) instead of on every frame until connected,
which would have made every frame a keyframe while ICE came up.

voelin_core::studio re-exports the studio, starts it from studio.scenes and
keeps the two in step both ways without echoes; studio.replay_seconds,
studio.replay_memory_mb and studio.recording_dir join the built-in keys
(with feature media). tests/studio.rs records a stream that switches scenes
live and saves a clip, and decodes both with ffmpeg: red before the switch,
blue after it, VP8 and Opus in sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:02:40 +03:00
selikhovandClaude Opus 5.5 4e63ac1425 Restore the dev profile entries the studio branch dropped
The studio's sources commit removed nine [profile.dev.package.*] entries
(sonora's AEC, noise suppression and FFT crates, str0m-proto and its
crypto provider, libspa, x11rb-protocol, wayland-backend). Nothing in the
studio needs that, and those crates are on the audio and stream hot paths
that ab82b0c optimised in dev builds for a reason: unoptimised, they cost
the debug client real CPU per 10 ms of audio. All nine are still in
Cargo.lock, so the entries match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:02:29 +03:00
selikhov 9cf1684988 Merge branch 'worktree-agent-ac629e6df2e4ff6f5' into worktree-agent-ae018f32455363dbb 2026-10-03 01:43:35 +03:00
selikhovandClaude Opus 5 7f184316a6 voelin-media: give the studio a controller and background blur
The UI needs one place to drive: a Command per thing a person can do, a
stream of Events back, and a preview it reads at its own size and rate
without ever holding up the composite. Studio is that place. It keeps the
scene graph, starts and stops the inputs the live scene needs, runs one
compose thread at the output rate, and tees encoded packets to the outputs.

Making the composite a ScreenCapture backend (StudioCapture, SourceId::Studio)
is what keeps the rest untouched: the streamer's conversion, simulcast,
encoders and peers see an ordinary screen source, and recording and the replay
buffer need no stream at all.

A source is restarted only when its input really changed -- a portal token
written back into the scene is not a reason to ask the user again -- so a drag
or an opacity change costs nothing but a replan.

Background replacement runs the segmenter on its own thread at a tenth of the
video rate and takes its newest mask latest-wins, because a mask a few frames
old is still right and segmentation costs far more than a frame. The blur is a
three-pass box blur, separable and with a running sum, so its cost is flat in
the radius; it is split into bands of rows on the worker pool over pooled
buffers. The vertical pass restarts its sum per band, which costs a few reads
and keeps the pass free of unsafe.

What segments is a centred oval, not a person: no ONNX model is loaded in this
build. The Segmenter trait is the seam for one, and segment.rs says so plainly
rather than implying the blur follows a person.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 23:51:03 +03:00
selikhovandClaude Opus 5 9be547ed6d voelin-media: push the studio to a WHIP service
Going live to a broadcast service is the one output that is not a file, and
WHIP is the standard that makes it one HTTP request: post the offer, apply the
answer, delete the location to stop. str0m already drives WebRTC here, so the
session is a thread of its own fed through a bounded channel -- a slow or dead
upload drops its own packets instead of stalling an encoder.

The session offers only the codec the studio already encodes plus Opus, so the
service can never negotiate its way into a second encode.

Candidates are one host candidate on the interface that routes to the service,
found by connecting a throwaway socket: enough for a service with a public
address and for a server on this machine, not enough behind a NAT the service
cannot reach back through. STUN and TURN are not here yet.

tests/studio_whip.rs is a WHIP server built on str0m in the test: the offer is
posted, ICE and DTLS come up, real VP8 and Opus packets arrive, a refusal is
reported with the service's own words, and stopping deletes the resource.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 23:39:11 +03:00
selikhovandClaude Opus 5 eb86ef9fba voelin-media: record the studio and keep a replay buffer
Recording and the replay buffer must work whether or not a stream is live,
and neither may cost a second encode, so both are fed the packets the
streamer's encoders already produce. That makes them output sinks over one
small trait rather than pipelines of their own.

The container is an own EBML writer: Matroska and WebM need so little of the
format for this (a header, one Info, one Tracks, clusters of SimpleBlocks)
that a dependency would be the larger cost. The segment size stays unknown
and there are no cues, so a recording cut short by a crash still plays; only
the duration is written back at the end, because a file of unknown length is
a poor thing to hand a player. H.264 is stored the way Matroska wants it,
length-prefixed with its parameter sets in CodecPrivate, which is why the
header waits for the first keyframe.

The replay buffer keeps whole keyframe groups so a clip always starts where a
decoder can, and a window longer than memory allows spills its oldest packets
to a temporary file it drops again once they age out -- the length is a
setting with no maximum, so it cannot be bounded by what fits in RAM.

RTMP is a seam that says what it is waiting for (the muxing side of the
FFmpeg loader) instead of dropping a stream silently.

tests/studio_record.rs runs real VP8 frames through both and reads the files
back with ffprobe: codecs, size, duration, and every frame of a clip decoded.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 23:32:23 +03:00
selikhovandClaude Opus 5 cd26086246 Merge identity import from the official TeamSpeak clients
Identities live in the ProtobufItems table of both the TeamSpeak 3 and
6 client databases, as the TS3 export string inside a typed item.
Voelin reads those databases read-only and immutable, imports .ini
exports and both clients' stores, skips duplicates by unique id, and
exports back to the .ini form so identities are never trapped here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 18:38:04 +03:00
selikhovandClaude Opus 5 5fb93dc33d voelin-media: make a real camera negotiate
Tried against a real V4L2 camera through PipeWire, three things stopped it.
A camera offers fixed frame rates (often only 30), so a rate range capped at
the wanted rate never intersects: the offer now takes any rate and the frame
pacer brings it down. Camera nodes hand out buffer types the CPU cannot map
unless asked otherwise, as screen capture already does. And PipeWire takes
the first offer that fits, so a size range alone gave the camera's smallest
size: the exact size is offered first, the range second.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 18:37:48 +03:00
faumarayandClaude Opus 5 4b26832bcf Say in docs/identity.md what import actually does and does not
The format description was written before the code; bring it in line with what
shipped, and be explicit about the two costs a reader would otherwise discover
the hard way: `immutable` means an identity the running client has not yet
checkpointed is not seen, and the Qt secrets file path is best-effort because
no such file existed to develop against.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 18:35:08 +03:00
selikhovandClaude Opus 5 a35d3b6784 voelin-media: give the studio its sources and cameras
A scene needs something behind each of its sources. Colour, text and image
are drawn once and put in the feed; screens, windows and the portal run the
existing capture backends through a sink that copies into pooled frames;
cameras get their own module. One broken source only sets its feed's error,
so it never stops the studio.

Text is rasterised with ab_glyph and the same Inter the UI bundles (reached
across crates rather than copied, and tools without the UI crate need it
too); images come from the `image` crate, which the tree already had.

Cameras are listed straight from V4L2 -- the card name and every pixel
format and resolution the driver reports, no hard-coded list -- but captured
through PipeWire, which already owns the devices; the connection comes from
the user's daemon or, in a sandbox, from the XDG Camera portal, and both
reuse the screen capture's PipeWire thread. Only the three read-only
enumeration ioctls are hand-written, so no bindgen build dependency joins
the tree. The test pattern is always listed as a camera, which is what the
tests use.

convert gained a borrowed-frame entry point so a capture buffer becomes RGBA
without an owned frame in between.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 18:34:16 +03:00
faumarayandClaude Opus 5 dda2ca0acc 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
faumarayandClaude Opus 5 90f234cff4 Import identities from the official clients
Switching to Voelin should not mean starting over on every server: the unique
id is the key pair, and a user who cannot bring it along loses every server
group they have. So read the forms the official clients keep it in — the
TeamSpeak 3 `.ini` export, the `ProtobufItems` items both clients write, and
the older `Identities/<n>/…` rows — and store them through voelin-store,
skipping unique ids the store already has instead of adding a second copy.

Export back to the `.ini` form in the same module: an importer without an
exporter traps people here, which is the thing being fixed.

The clients' databases hold private keys and may be open in a running client,
so they are opened read-only and `immutable`: no lock, no shared-memory file,
no write-ahead log replay, nothing of the user's changed to read it. The cost
is that an identity written but not yet checkpointed is not seen, which is the
right way round.

Three field numbers do not earn a protobuf dependency; the wire reader is
twenty lines and skips what it does not understand. An item is taken as an
identity only when its declared type says so, never because a field number
happens to match.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 13:44:41 +03:00
selikhovandClaude Opus 5 7b61fa9cad voelin-media: composite a studio scene into pooled frames
The studio needs one picture per output frame from any number of sources
that each run at their own pace, so the compositor takes each source's
newest frame through a latest-wins handoff and draws the scene back to
front into a pooled RGBA canvas, in bands of rows on a worker pool. The
plan (destination rectangles and filter weights) is kept while neither
the scene nor a source size changes, which is what lets a steady
composite allocate nothing per frame -- the property tests/studio_alloc.rs
pins down.

Frames are RGBA because alpha blending and text need it; the streamer's
existing conversion turns the canvas into I420 for the encoders in one
SIMD pass. Scaling reuses scale.rs's weight tables with an inner loop for
interleaved pixels, and a straight copy at 1:1, the common case for a
screen that already matches the canvas.

FramePool grew a format so the same recycling works for the canvas, and
the preview tap scales the canvas down through the same filter.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 13:39:12 +03:00
faumarayandClaude Opus 5 840d9ce366 Describe where TeamSpeak keeps identities
Both official clients store identities in a `ProtobufItems` table of their
`settings.db`, not in the settings rows: one protobuf item per object, the item
type in field 6 selecting which payload field carries the body, and type 1
(field 17) holding the TeamSpeak 3 export string plus a nickname. Working that
out is the prerequisite for importing, so write it down before the code.

The myTeamSpeak account record sits in the same database and is easy to mistake
for an identity store; note that it carries no key pair and that the account
service stays out of scope, so the question is not reopened.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 13:36:40 +03:00
selikhovandClaude Opus 5 a300dfbd28 voelin-media: add the Stream Studio scene graph
The studio needs a description of what it composites that survives a
restart, so the UI's scenes and sources are one serde value (the
`studio.scenes` setting) with a default for every field: adding a field
later keeps older settings files loading.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 10:06:35 +03:00
Claude 2f19a340f7 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 2f35cd0057 voelin-core: load contacts before handling the next command
The contacts read from the database replaced the list in memory when the
read finished on the writer thread. A SetContact handled meanwhile was
lost (its write was queued behind the read), which made
contacts_are_kept_in_the_database fail under load. The engine now awaits
the read at start and after AttachHistory before its next command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-29 01:41:47 +00:00
Claude 628bc11a04 Merge files, avatars, pokes, offline messages and contacts in the engine
Channel files with streamed transfers, avatars and icons in a bounded
cache, file links in chat, pokes, private messages to anyone, TS3/TS6
offline messages, server details and groups, and a contacts table that
drives friends' presence, blocking and the friends stream permission.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-29 01:41:47 +00:00
Claude c08584175e voelin-media: drop a needless mut in the FFmpeg bitrate test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-29 01:23:35 +00:00
Claude 69312656f2 voelin-ui: keep avatars and icons next to the database on Android
The engine caches avatars and icons in the platform's cache directory,
which Android does not have (it would resolve to a relative path). A
host that names the data directory gets the cache in <data>/images.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-29 01:22:47 +00:00
Claude 9cdc336c2d voelin-media: bitrate increases reach encoders that cannot change it running
VA-API, AMF, SVT-AV1 and the other wrappers without a live bitrate change
applied a new target only at the next keyframe, so a still screen kept
the bandwidth estimate's low start value for good. An increase of half or
more now reopens the session (a keyframe) once it is five seconds old;
smaller ones still wait for a keyframe, drops below half apply at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-29 01:13:44 +00:00
Claude c4021b9859 voelin-core: live test of a viewer that answers another codec
Against the TeamSpeak 6 dev server: the streamer offers VP9 (its stream
codec) and VP8, a viewer that decodes only VP8 answers VP8 and decodes
pictures from the encoder made for it, and the VP9 encoder, wanted by
nobody, idles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-29 01:12:15 +00:00
Claude d769ab8910 docs: FFmpeg encoders, per-viewer codecs, how to install FFmpeg
docs/media.md: how FFmpeg is found (VOELIN_FFMPEG_DIR, VOELIN_FFMPEG,
any major version), which struct fields are read and how they are
checked, the backends and their realtime settings, runtime bitrate and
size changes, buffers, what is zero-copy and what is missing (the GPU
colour conversion), installing FFmpeg per OS, the offer with several
codecs and an encoder per codec viewers chose, the computed H.264 level,
the new API, voelinctl, licenses and what was tested how.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-29 01:10:26 +00:00
Claude fec23905d6 voelin-media: DMA-BUF import into VA-API encoders, up to the GPU conversion
FfmpegEncoder::encode_dmabuf maps a DRM PRIME frame onto a VA-API surface
(av_hwframe_map) that the encoder reads without a copy. It needs
AVFrame.buf[0] and AVFrame.hw_frames_ctx, which have no accessor: their
offsets come from a table per libavutil major, buf[0] is checked on a
real frame at load and hw_frames_ctx on the encoder's first surface.
Only NV12 buffers are taken: screen capture delivers RGB, which needs a
colour conversion on the GPU (VA-API video processing) that is not
implemented; anything else is refused as unavailable so the caller maps
the buffer as before.

On the capture side, FrameSink::accepts_dmabuf / dmabuf let the portal
hand a buffer over before mapping it (and pass tiled ones through). No
sink accepts yet, and the portal still negotiates LINEAR buffers only.

The encoder ends its stream when dropped (SVT-AV1 logs an error
otherwise).

Untested on a GPU: this machine has no render node.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-29 01:02:36 +00:00
Claude 71d51d1271 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 f60d06e367 docs: server details, files, avatars, messages and contacts
The architecture document describes what the engine now offers for the
new UI: client and server details and groups in the presence, channel
files and chat file links, the avatar and icon cache, pokes, private and
offline messages, and contacts with friends' presence and blocking, with
the protocol facts they rest on (avatar file names, icon ids, TS6 unique
ids for offline messages, the transfer port).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-29 00:57:41 +00:00
Claude 556c1d0278 voelin-core: engine tests for contacts and voice requests
Through the public API without a server: every request without a voice
connection is answered with its own id (FileList, Transfer, RequestDone,
OfflineMessages), and contacts set and removed are stored in the client
database, reported with FriendPresence and loaded again by an engine
that attaches the database later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-29 00:56:57 +00:00
Claude 2927100b20 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 7b2007ea89 it-smoke: files, avatars, pokes, messages and contacts through the engine
The engine's voice features get a round trip on both servers with
voelinctl engine: a 1.5 MB upload linked in channel chat and downloaded
from the link by another client (compared byte for byte), listed by a
guest and deleted; an avatar set by one client and fetched by another
(MD5 checked); poke, private message and offline message round trips
(offline messages go to the unique id the server knows, the TeamSpeak 6
one on TS6); a friend seen online; a blocked contact's poke flagged.
Nicknames carry the run's tag so leftovers of earlier runs cannot be hit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-29 00:54:55 +00:00
Claude 6dce4ee8e9 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 43d3468e47 ts-bookkeeping: parse TeamSpeak 6 times in milliseconds
TeamSpeak 6 (6.0.0-beta13.1) sends the `datetime` of notifyfilelist in
milliseconds. The parser read it as seconds, failed on the out-of-range
date and dropped the whole message, so every file list came back
empty. Times from 10^11 on (year 5138 in seconds) are now taken as
milliseconds.

The TS6 dev server gets its own file transfer port (30034): clients
connect to the port the server announces, and 30033 on the host is the
TS3 server's, so transfers with TS6 went to the wrong server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-29 00:41:31 +00:00
Claude 7db95404f5 Merge the audio mixer (ba69a4f) into the FFmpeg encoders branch
Both add to StreamerConfig, the reconfigure docs and the imports of core
media.rs and the UI's video.rs; kept both sides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-29 00:39:15 +00:00
Claude 817ef1549d 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 6e5e138cca Encode each layer once per codec its viewers chose (WIP)
Offers list the stream codec first, then the codecs of hardware encoders,
VP8 through libvpx and HEVC last; software encoders other than VP8 are
only ever the stream codec, so no answer starts an expensive one. The
streamer's peer reports the codec each answer chose, the session sends
video only to viewers of its codec and tells the encoders through
LayerFeedback which codecs are needed. Each layer's encoder thread keeps
one encoder per such codec, made when a viewer needs it and dropped when
none does; the stream codec is skipped while nobody takes it.

The H.264 profile-level-id is computed from macroblocks per second, frame
size and bitrate (Table A-1), at least 3.1 as before. Streamer takes an
encoder preference (hardware on/off, auto / software / a named backend)
that reconfigure can change live. HEVC is negotiable (str0m packetizes
it) and only offered when a hardware encoder has it.

Work in progress: committed early so it cannot be lost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-29 00:33:16 +00:00
Claude d28ecebe43 voelin-core: files, avatars, icons, pokes, offline messages, contacts
The new UI needs a channel file browser, avatars and icons, pokes,
direct messages to anyone, the offline message inbox and a friends list.
The voice connection can do all of it; the engine did not offer it.

Files (module files): ListFiles, DownloadFile (to disk as <path>.part,
renamed when complete, resumable, or into memory), DownloadChatFile for
a FileRef from a chat message, UploadFile, CancelTransfer, DeleteFiles,
RenameFile, CreateDirectory. Transfers stream in 64 KiB pieces and
report Requested/Started/Progress (files.progress_interval_ms)/Done/
Failed/Cancelled; requests and transfers carry an id the caller picks.

Avatars and icons are fetched by themselves (cache.fetch_images) into a
content-addressed disk cache (module cache: avatars by MD5, icons by id,
LRU bounded by cache.max_mb, 0 = no limit, use times kept as file times,
concurrent downloads of one file deduplicated across sessions) and
reported as AvatarReady / IconReady. SetAvatar uploads ours and
announces its hash, or removes it.

Pokes are a command and a distinct event (they were stored as private
messages before). A failing voice command (e.g. a private message to a
client who left) is now an error event instead of ending the connection.
Offline messages (module offline) list, read, send, delete and mark.

Contacts (module contacts) are engine-wide and stored in the client
database: SetContact / RemoveContact, ContactsChanged, FriendPresence
across all sessions, last seen time and server, per-person volume and
mute applied in every session, blocked authors flagged in chat and
their pokes and private messages hidden or flagged (privacy.block_mode),
and stream.permissions = friends lets friends watch without asking.

ServerDetails and Groups events report the server's details and groups
when they change. The book mapping moved to its own module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-28 19:50:39 +00:00
Claude ba69a4f62d 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 29c70c824c voelin-core: live media test checks the mixed audio goes out
ts6_test_pattern_decoded checked only the decoded video. It now also
checks that the streamer sent at least 50 Opus frames of the mixed test
tone while the viewer decoded, and that no audio source reported an
error. Passes against the TeamSpeak 6 dev server (VOELIN_LIVE=1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-28 19:36:38 +00:00
Claude 8b9ea9ca1d voelin-media: test FFmpeg encoders end to end, fix what that found
The self-test and a roundtrip through our own decoders (OpenH264 for
H.264, dav1d for AV1) run for every FFmpeg software encoder present:
x264, SVT-AV1, rav1e and libaom all decode above 28 dB PSNR with the
keyframes where they were asked for.

Fixes: SVT-AV1 takes CBR from rc=2 and rejects a maximum rate equal to
the target; rav1e refuses a keyframe interval of 2^30 and holds about 20
frames even in low-latency mode, so it is only used when named; a new
session flushes the old one so delayed frames are not lost; the first
packet of a session counts as a keyframe; FFmpeg's log lines go to the
encoder they are about when backends are tested in parallel.

Codecs::builtin() gives the compiled-in codecs alone, for tests that
check libvpx or OpenH264 specifically.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-28 19:30:29 +00:00
Claude 8dcd631fab voelin-store: contacts table (schema version 3)
Home's friends list, blocking and per-person volume need a place for
people the user marked. Contacts are keyed by the client's unique id
(the same on every server) and carry a nickname hint, the relation
(friend, blocked, neutral), a note, mute and volume, when they were
added and when and where they were seen last.

Migration 3 adds the table; existing data stays. touch_contacts records
many sightings in one transaction and never moves last_seen back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-28 19:26:23 +00:00