Commit Graph
188 Commits
Author SHA1 Message Date
selikhovandClaude Opus 5.5 2a75b64465 docs/media.md: the CPU range of the hardware encoders includes the re-run
The summary under the tables still gave 0.20-0.42 cores, the range before
the av1_vaapi re-run added 0.38-0.52.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 06:43:22 +03:00
selikhovandClaude Opus 5.5 0f8db57c71 docs/media.md: av1_vaapi now holds its bitrate
Add the re-measured av1_vaapi rows next to the first ones (5982 kbit/s
for 6000 asked at 1080p60, 9920 for 10000 at 1440p60, against 6211 and
10794 before), with what the encoder-only measurements showed: only the
rate-control buffer moved Mesa's AV1 rate control, and with two seconds
the stream is no burstier than the other hardware encoders'. The CPU
figures of these later runs are given as ranges with a control run,
because the machine was in use and they varied between runs while the
bitrates repeated exactly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 06:42:44 +03:00
selikhovandClaude Opus 5.5 9ebffac8af voelin-media: give av1_vaapi a two-second rate-control buffer
The measurements on the RX 7900 GRE had av1_vaapi as the one backend that
did not hold its bitrate: 3.5 % over at 1080p60 / 6 Mbit/s and 7.9 % over
at 1440p60 / 10 Mbit/s, on the desktop pattern, every frame encoded. A
stream that keeps sending more than the estimate allows is answered by
the congestion control with loss and a lower target.

Measured directly on the encoder, 600 frames after 120 of warm-up:
`maxrate`, `rc_mode`, `blbrc` and the QP bounds change nothing; only the
buffer does. With twice the bitrate as `bufsize` it lands at -0.8 %
(1440p60), -0.2 % (1080p60) and -1.2 % (720p30 / 2 Mbit/s), no frame
skipped, the largest frame 68 KB against 64 KB before (h264_vaapi's
largest at the same settings is 86 KB). Every other backend keeps the
one-second buffer it was within 2 % with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 06:35:27 +03:00
selikhovandClaude Opus 5.5 5a64861aaa docs/media.md: the GPU colour conversion and what zero-copy costs
Describe the encoder's half of zero-copy as it now is: RGB DMA-BUFs
converted to NV12 by VA-API video processing on FFmpeg's display, why
libva is driven directly instead of libavfilter, and the colour
description that keeps Mesa from converting the transfer function.
Record the measurement (0.08-0.09 ms of CPU per 2560x1440 frame against
4.3-5.2 ms through shared memory), the checks against the CPU conversion,
the flush crash a failed import exposed, and libva among the licenses.

Say plainly what is still not reached: the streamer's sink does not take
DMA-BUFs, so no captured frame has used this path, and a real capture
through it needs that sink and another portal run. Also correct the
portal threshold, which 9b09e7b moved from 6 to 1 ns per pixel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:43:11 +03:00
selikhovandClaude Opus 5.5 a2c630358b voelin-media: build the FFmpeg encoders where rustix is not a dependency
rustix is a Linux-only dependency, but the code that redirects standard
error during the probe was compiled for every unix, so the default
`ffmpeg` feature did not build for Android (checked:
`cargo check --target aarch64-linux-android --no-default-features
--features ffmpeg`) and would not for macOS. On Windows the type had no
Drop impl, which `clippy --target x86_64-pc-windows-gnu`, the documented
check of the Windows code, refused (drop_non_drop).

Gate the redirection on Linux and keep a Drop impl everywhere. The new
LINEAR DMA-BUF test buffer (/dev/udmabuf) is Linux-only as well, so the
Windows check with --all-targets passes again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:41:17 +03:00
selikhovandClaude Opus 5.5 2bd78ca39d voelin-media: hand a DMA-BUF-taking sink the buffer's real size
The portal offers a sink that accepts DMA-BUFs the buffer as it is, with
its size taken from `mapoffset + maxsize`: the same fields 9b09e7b found
0 for every DMA-BUF this compositor sends, which left the mapping empty.
On the sink path the size goes into the DRM PRIME descriptor of the
import. Mesa happens to ignore it (an import with size 0 encoded the same
picture here), but the size is part of the descriptor and other drivers
use it, so ask the buffer object (lseek to the end, which a DMA-BUF
answers with its size) and fall back to the rows the format describes.

The module documentation now says what a DMA-BUF-taking sink gets, and
why tiled buffers are still not offered: the modifiers the encoder's
driver imports are not known on this side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:35:34 +03:00
selikhovandClaude Opus 5.5 3982b8db71 voelin-media: convert RGB DMA-BUFs to NV12 on the GPU for VA-API encoders
Screen capture hands over RGB, and encode_dmabuf took only NV12, so the
zero-copy import never carried a captured frame. VA-API encoders now take
XR24, AR24, XB24 and AB24 buffers too: the buffer is mapped onto a VA-API
surface of its own size and converted into the session's NV12 surface by
VA-API video processing, cropped to the coded size on the way, and the
call returns once the GPU has read it, so the buffer can go back to the
compositor.

The conversion goes straight to libva (vaCreateConfig with
VAEntrypointVideoProc, one VAProcPipelineParameterBuffer per frame) on
FFmpeg's own VADisplay, found through AVHWDeviceContext.hwctx, located
and checked like the other fields. FFmpeg has the same conversion only in
libavfilter, which would be another library to find and a filter graph
to drive for one call. libva is the library FFmpeg's VA-API support
already loaded, and its ABI has not changed since libva 2.

Measured against the CPU's conversion of the same picture: Mesa converts
the transfer function as well unless told otherwise, and a dark pixel
came out 5 levels too bright (grey 30 as Y 47 instead of 42). Describing
the input with BT.601 primaries and transfer, as the output, leaves just
the matrix: Y now matches exactly, U and V within 0.7 on average.
Through h264_vaapi and av1_vaapi to our decoders the GPU path is within
0.3 dB of the CPU path, from the driver's own tiled buffer and from a
LINEAR one with a padded pitch (/dev/udmabuf), which is what the portal
negotiates.

CPU per 2560x1440 frame on the way into h264_vaapi (release): 4.3-5.2 ms
when the CPU converts and uploads, 0.08-0.09 ms from an RGB DMA-BUF;
0.26-0.31 cores at 60 fps against 0.005.

Also: dropping a VA-API encoder whose first frame failed (an import that
failed, here) drained a session that had never received a frame, and
FFmpeg 9's h264_vaapi crashes doing that (SIGSEGV in avcodec_send_frame,
reproduced with an empty session alone). Sessions remember whether a
frame went in and are only flushed then.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:32:22 +03:00
selikhovandClaude Opus 5.5 f826d09e7b docs/media.md: what the GPU encoders' output decodes to
Record the hardware round-trip per encoder and size, the AV1 padding it
uncovered on this GPU (1080 rows sent as 1082, other sizes padded to
64x16) and the crop that replaced it, and that the AV1 decoder has now
decoded the streams of five encoders rather than none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:04:44 +03:00
selikhovandClaude Opus 5.5 897087112e voelin-media: decode what the GPU encoders produce, and crop AV1 to what RDNA3 encodes
Nothing had ever decoded the output of a hardware encoder. The round-trip
the software encoders go through (our own decoders: OpenH264 for H.264,
dav1d for AV1; keyframes where asked, timestamps kept, PSNR above 28 dB)
now runs over every usable H.264 and AV1 hardware backend, at 320x240 and
at 1920x1080, which is not a whole number of macroblocks.

h264_vaapi and h264_amf decode exactly at both sizes (the SPS crops the
coded 1088 rows). av1_vaapi and av1_amf do not: on this RX 7900 GRE the
AV1 encoder pads the width to a multiple of 64 and the height to 16, and a
height 8 more than a multiple of 16 by 2 rows, so 1366x768 comes out as
1408x768, 1600x900 as 1600x912 and 1920x1080 as 1920x1082. AV1 has no
cropping like H.264's SPS, so every viewer would show the padding.

The self-test of AV1 backends now encodes 258x258, 2 more than a power of
two, reads the frame size the sequence header declares, and derives the
alignment the encoder pads to; encoders crop frames to it, as they already
cropped odd sizes to even ones. Measured here: (64, 16) for both AV1
hardware backends, (2, 2) for the software ones, so 1920x1080 is sent as
1920x1072 and decodes as exactly that. Taking the alignment from the
stream instead of from the GPU's name keeps hardware that does not pad
uncropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 02:04:03 +03:00
selikhov 5b70c44ba9 Merge branch 'worktree-agent-a7f9f51b4ced7cef7' into worktree-agent-a97633f32fc7a58c8 2026-10-03 01:43:37 +03:00
selikhovandClaude Opus 5.5 a5ec729234 WIP: round-trip test for the hardware encoders (interrupted by a session limit)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 01:42:18 +03:00
faumarayandClaude Opus 5 b7534cc128 docs/media.md: what a real Wayland capture costs, before and after
The low screen-share frame rates on Wayland had never been reproduced here.
Record the run that did: what the broken DMA-BUF mapping did, what reading a
discrete GPU's buffers with the CPU costs against shared memory, and where
the threshold that chooses between them now sits.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 23:51:11 +03:00
faumarayandClaude Opus 5 9b09e7bde2 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 91bca224d7 docs/media.md: the DMA-BUF import is tested, the capture path still is not
Separate the two halves of zero-copy that the measurements now tell apart:
the import into a VA-API encoder carries a real tiled buffer on this GPU,
while nothing from screen capture reaches it, because the portal delivers RGB
and because Ingest never accepts DMA-BUFs in the first place.

Also record the layer shape the import expects against the one a driver
exports, which the test uncovered.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 23:32:04 +03:00
faumarayandClaude Opus 5 21843fd7c1 voelin-media: put a real DMA-BUF through the VA-API encoder
The probe reported the zero-copy import as available on the strength of the
struct offsets alone, and screen capture only ever hands over RGB, which the
import refuses, so no buffer had ever gone through it on hardware.

Make a VA-API surface, export it as a DRM PRIME DMA-BUF and feed it back to
a second encoder through encode_dmabuf. On this GPU it imports and encodes,
and the buffer carries an AMD tiling modifier (0x200000028a01f04), so tiled
buffers work and not only LINEAR ones.

It also showed that the import's shape is narrower than what drivers
produce: this driver describes an NV12 surface as two DRM layers, R8 for the
luma plane and GR88 for the chroma one, while encode_dmabuf takes a single
NV12 layer with two planes, which is how a compositor hands one over. Both
name the same bytes of the same buffer object, so the test flattens the
layers; whoever wires the portal to the encoder should accept either form.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 23:31:45 +03:00
faumarayandClaude Opus 5 678d46e2b5 docs/media.md: the hardware video path as measured on a real GPU
Everything about the FFmpeg encoders was written without a GPU to run them
on. Record what a Radeon RX 7900 GRE with FFmpeg 9.0.1 actually does:
software against VA-API and AMF at 1080p60 and 1440p60, a simulcast run, and
what the numbers mean (every encoder holds the frame rate, so the difference
is CPU — 0.20-0.42 cores against 1.16-2.55 — and the steady state is 1.02
allocations per encoded frame on hardware as on software).

Also record what the measurements found and changed: the H.264 level the
encoders emit against the one the offer advertises, the probe's startup cost
and the third-party output it used to print, and the libavutil 61 offsets.
The verification table now separates the hardware that was tested here from
the hardware that was not, and says plainly that the zero-copy import has
still never carried a frame because the GPU colour conversion is missing and
that the portal measurement did not run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 18:43:48 +03:00
faumarayandClaude Opus 5 049a873b7d 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
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
faumarayandClaude Opus 5 e599eab0ac voelin-media: stop probing absent GPUs and keep the encoder libraries quiet
The startup probe opened every encoder in the table, which took 1.77 s here
and froze the app's first use for that long, and it let the libraries behind
them print about thirty lines to standard error on every run.

Most of the time went on hardware that is not in the machine: a self-test of
a family whose vendor is absent still runs its driver's initialisation
before failing, 1.7 s for av1_nvenc and 1.2 s for vp9_qsv here. Read the PCI
vendors of the DRM render nodes once and skip those families outright; when
the vendors cannot be read nothing is skipped, so an unusual setup only pays
what it paid before. The report gains a plain reason ("no NVIDIA GPU in this
machine") in place of a CUDA error code.

FFmpeg's own log already goes to tracing, but SVT-AV1's build banner, AMF's
GetProperty warnings and Mesa's RADV_PERFTEST notice are written to the
descriptor by the libraries themselves. Point standard error at a temporary
file while the self-tests run and log what landed there as one debug record;
VOELIN_FFMPEG_PROBE_STDERR=1 leaves it alone.

Measured with `voelinctl stream encoders` (release): 1.77 s before, 0.93-1.12
s after, 12 backends tested instead of 20, and nothing on standard error.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 18:35:39 +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
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
faumarayandClaude Opus 5 b541ec8093 voelin-media: tell the H.264 encoders the level the offer advertises
The signalling computes profile-level-id from the stream's size, frame rate
and bitrate, but nothing told the encoder, so every wrapper picked its own
level. Measured on this GPU: h264_amf writes level 4.2 into the SPS of a
720p30 stream whose offer says 3.1, and 5.0 for a 1440p60 stream offered as
5.1. A viewer that sizes its decoder from our SDP can refuse a stream that
declares more than the offer did, which is what breaks official clients.

Compute the level from ITU-T Table A-1 and set it on both the codec context
and the wrapper's private option. A new test parses the SPS of every usable
H.264 backend at two sizes and both profiles and asserts profile_idc against
the offer and level_idc never above it; with the level set, all three
backends now emit exactly the offered level.

The level table is a second copy of the one in voelin-stream, because
neither crate can depend on the other, so a unit test pins them together
over a spread of sizes, rates, bitrates and profiles.

Remaining difference, only in the constraint-flag byte and left alone: the
offer claims Constrained High (0c) and Constrained Baseline (e0) as WebRTC
implementations conventionally do; the VA-API and AMF encoders emit 0c for
the former, libx264 emits 00, and all three emit 40 or c0 for the latter.
The bits do not change what a decoder can decode.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 13:39:37 +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
faumarayandClaude Opus 5 4fac682cae voelin-media: record the AVFrame offsets of libavutil 61 instead of guessing
The DMA-BUF import reads AVFrame.buf[0] and hw_frames_ctx at offsets the
loader keeps in a table per libavutil major. The table ended in an open
range that answered every major from 60 up with 60's offsets, so on this
machine (libavutil 61) the import ran on an unverified guess, and a future
major would get the same treatment.

Compiled offsetof from the headers installed next to the library: libavutil
61 puts buf at 184 and hw_frames_ctx at 328, which is what 60 uses, so the
guess happened to hold. Record 61 explicitly and stop answering unknown
majors: AVFrame has shrunk between majors (424 bytes in 61 against 536 in
56), so an offset guessed for an unknown layout can point past the end of
the struct. An unlisted major now turns the import off with a reason and
leaves everything else working.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 13:33:52 +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
Claude 757d7c6382 docs/media.md: stream audio sources, the mixer, application capture
A "Stream audio" section covers the source kinds, how the mixer
behaves (latency, underruns, drift, limiter, meters), the audio thread's
clock and RTP time, live reconfiguration and per-source errors, the
stream.audio_sources setting, and per platform how application audio is
captured (all but ours, one app, the app list). The PipeWire note no
longer says our voices reach viewers, the pipeline diagram and streamer
bullets name the mixer, and the verification table lists the new tests
and what is only type-checked (WASAPI) or only compiled (Android).

The link manager's module doc also covers the marker property used in
sandboxes and the skipping of loopback and filter outputs.

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