Commit Graph
623 Commits
Author SHA1 Message Date
selikhovandClaude Opus 5.5 146502c9ca voelin-media: find the person for the studio's background replacement
Blur, image and colour backgrounds were cut around a centred oval: no
segmentation model was in the build. `segment::HumanSeg` (feature
`segment`, on by default) now runs PP-HumanSeg, PaddleSeg's portrait
segmentation model as OpenCV Zoo ships it (Apache-2.0, 6 MB, bundled in
crates/voelin-media/models with its licence and SHA-256), on the CPU with
tract-onnx: the frame squeezed to 192x192 RGB, the probability of a person
per pixel out as the mask. It is the default segmenter; the model is
parsed and optimised once per process on the segmentation thread, and if
it does not load the oval stands in. Builds without the feature keep the
oval.

One mask takes about 50 ms on one core (tract is optimised in dev builds
too, as voelin-media already is; unoptimised it took 430 ms), so the 10
masks a second cost about half a core. A new test checks the model loads,
the mask size, that an empty evenly lit room has next to nobody in it, and
the time per mask; the frame-path tests now use the oval explicitly, since
they need a mask known in advance. On a photo of a person the mask
follows the silhouette, arms and legs included (checked by eye; the photo
is not committed). Not yet tried with a camera.

The notices list the model and its licence; THIRD_PARTY_NOTICES.md is
regenerated for tract and its dependencies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:22:56 +03:00
selikhovandClaude Opus 5.5 0bc96437e5 Show what a watched stream delivers: size, frame rate, bitrate
A viewer could see the codec and the picture's size of a watched stream,
but not how many pictures arrived or at what bitrate, so a choppy or
starved stream looked like any other.

DecodeStats now counts the video bytes received and gives the decoded
frame rate and the received bitrate since the previous `stats()` call (at
least half a second; the watch screen asks once a second, other readers
share the same window). The watch screen shows "VP8 · 1280×720 · 30 fps ·
0.4 Mbit/s" in small text in the player's control bar, where a spacer was,
and in Stream Info.

These are read from the decoding pipeline, which runs in the app, rather
than sent as an engine event as planned: the engine never sees the decoded
pictures, and the screen already refreshes from these stats every second.

Tested: the local test pattern decodes at 20-40 fps and 0.1-5 Mbit/s
(media::tests::local_preview_decodes_the_pattern); a headless screenshot
of the watch screen with the sample stream showed the line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:20:02 +03:00
selikhovandClaude Opus 5.5 1eabbb4704 Android: cameras in the Stream Studio through Camera2
The studio listed only the test pattern on Android. voelin-media gains a
camera provider hook (like the external screen capture): the app
registers Camera2, whose cameras the studio's picker lists first (front
ones first, with their YUV sizes and highest frame rate), and a camera
source opens one. CameraCapture.kt asks for the CAMERA permission when a
camera is first opened (the source shows why if it is refused), opens
the camera into an ImageReader (YUV_420_888) at the wished size or the
nearest one (16:9 first, 1280x720 by default) with a fitting frame-rate
range, and hands each frame's planes to Rust as direct buffers valid
during the call, with the clockwise turn that makes it upright for the
screen's current rotation (front cameras turn the other way).

Rust takes the planes as YuvPlanes: an upright planar or NV12 picture
goes to the studio's sink as it is, converted straight from the
camera's memory; NV21 (what most cameras give) and turned pictures are
gathered into I420 in a buffer each camera keeps, so a running camera
allocates nothing per frame. Errors after the start (permission refused,
camera taken by another app) go to the source's feed.

Front and back: a camera's default mirroring now follows the camera (a
back camera is not mirrored, what faces the user is), and the source
menu gains Switch camera, which moves a camera source to the next
camera (and its name with it, if it was named after the camera).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:17:13 +03:00
selikhovandClaude Opus 5.5 8d14b0d5be Let a viewer pick the simulcast layer of a Voelin stream
The streamer chose each viewer's layer from its bandwidth estimate, and a
viewer could neither see which layers there were nor ask for one: the watch
screen's quality picker only asked for a keyframe.

A Voelin streamer with several layers now lists them in its offer, in a
session-level SDP attribute, `a=x-voelin-layers:<id>/<WxH or
scale>/<bitrate>[/<fps>] ...`, added to the SDP str0m makes (peer.rs is
untouched). A Voelin viewer reports them (WatchEvent::Layers,
Event::WatchLayers) and asks for one with Command::SetWatchLayer, which
sends `{"cmd":"x-voelin-layer","args":{"layer":<id or null>}}` through
streamsignaling. The streamer moves that viewer to the layer at its next
keyframe and keeps it there whatever the estimate says, without letting it
lower the layer's bitrate for everyone else; null ("Auto") hands the
choice back to the estimate. The watch screen's picker now drives it.

Official clients are not affected. libwebrtc skips session attributes it
does not know: headless Chromium 152 answers an offer carrying the line
and decodes as before (browser interop test, which now sends it). A viewer
sends the request only to a streamer whose offer had the attribute, and
only Voelin streamers add it, so official streamers never get the signal;
which codecs are offered does not change.

Tests: two sessions with peers on loopback switch the viewer to layer 1
and back on request; a streamer whose offer lists no layers is never
asked; the attribute round-trips. Through the TeamSpeak 6 dev server,
`voelinctl stream watch --layer 1` against a two-layer placeholder stream
kept the viewer on layer 1 at an estimate that fits layer 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:10:17 +03:00
selikhovandClaude Opus 5.5 3e37c24836 voelin-ui: let "Choose via system dialog" always open the portal's dialog
After a share that granted a portal restore token, every later share
passed the stored token, and xdg-desktop-portal restored the earlier
choice without showing its picker: on Wayland the share dialog's only
source, "Choose via system dialog", never showed a dialog again, and
nothing could change what was shared.

That entry now never sends the token, so the portal always asks (and may
grant a new token, which is stored as before). With a stored token the
share dialog lists a second entry, "Same as last time", which restores
the last choice without the dialog. The studio's portal sources are added
without a token and ask every time; docs/studio.md claimed the token was
written back into the scene, which the UI does not do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:07:27 +03:00
selikhovandClaude Opus 5.5 5da3f94479 voelin-ui: the phone's bottom navigation shows where you are
Home could be on screen while the bar marked Chats and the top bar
named the server: opening Home other than by its tab (the desktop's
logo before the window narrowed, VOELIN_OPEN=home) left the phone's tab
where it was. Nav.show now keeps the tab and the page together, also
while the window is wide, so the tab is right when it narrows. The
tabs go through Nav.show-tab, which also closes the pins, topics or
members page that was over the last tab, instead of leaving it over
the next one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:59:27 +03:00
selikhov f2ffd761fc Merge branch 'claude/gifted-lovelace-1crlx2' into worktree-agent-a33c34a3879196dbf 2026-10-03 17:51:48 +03:00
selikhovandClaude Opus 5.5 630ff848b2 Offer the codecs every TeamSpeak client decodes before H.264
The official client could not show a Voelin stream: its decoder was
libwebrtc's NullVideoDecoder. Its log says why. On a machine with a
hardware H.264 encoder our offer put H.264 first, with every H.264
variant str0m knows; the client answered H.264 42e01f, then had no
decoder for it, because it decodes H.264 only with an OpenH264 library it
downloads at start-up, and that download failed (HTTP 403). Its SDP
capabilities list H.264 either way. VP8, VP9 and AV1 it always decodes:
FFmpeg's decoders, dav1d and libaom are built into it.

- The hardware encoder order, the automatic stream codec
  (`preferred_codec`) and the offer (`offer_codecs`) now put the codecs
  every client decodes (`decoded_everywhere`: AV1, VP9, VP8) before
  H.264, HEVC last. A viewer answers with the first codec of the offer it
  lists, so official clients take one they can decode; H.264 stays
  offered for peers that want it, and `stream.codec` can still choose it
  (its description now says what that means for official clients).
- A streamer offers H.264 only as it encodes it (Constrained High,
  packetization mode 1), not str0m's other variants, which let a viewer
  answer a profile, or packetization mode 0, we never send. Viewers still
  accept every variant.

Tests: `crates/voelin-core/tests/browser_codecs.rs` (VOELIN_INTEROP=1)
streams the test pattern through every encoder this machine has, VA-API
also from DMA-BUFs, to headless Chromium's libwebrtc: VA-API H.264 and
AV1, libvpx VP8 and VP9, x264, SVT-AV1 and libaom all decode at
1280x720. A second test makes the offer a share makes here
([AV1, VP8, H264, H265]) and checks the browser picks and decodes a
codec every client decodes. The browser driver now takes playwright-core
with a system Chromium (VOELIN_CHROMIUM), which decodes H.264, and the
interop tests accept Chromium 152's name for the SRTP cipher. The
official client itself could not be run here (its beta needs a
myTeamSpeak sign-in on first start).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:50:37 +03:00
selikhovandClaude Opus 5.5 23bf7331c4 Show TeamSpeak 6's own viewer counts for streams
The streams list and the watch screen showed how many watch a stream only
when a gateway's directory knew it, although TeamSpeak 6 tells the count
itself: `viewer` in `notifystreaminfo`.

StreamInfo gets `viewers`: the server's count from `notifystreaminfo`, 0
for a stream that just started. Probed on the dev server, the server sends
`notifystreamclientjoined` to the whole channel but `notifystreamclientleft`
only to the streamer and the viewer who left, and no `notifystreamupdated`
for either; so the directory counts joins and leaves itself and the engine
asks `requeststreaminfo` again, one stream of another client every 5 s
round robin, which corrects the leaves it was not told about without
flooding the server however many stream. The app shows that count, and the
gateway's where the server gave none; `voelinctl stream list` prints it.

Against the TeamSpeak 6 dev server, a late `stream list` printed
"1 watching" while a viewer watched and "0 watching" after it left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:50:35 +03:00
selikhovandClaude Opus 5.5 a9a12bb4db voelin-media: run the X11 capture test only on a test display
The test maps windows, moves the pointer and captures the screen of
whatever DISPLAY names. On a desktop session (XWayland included) a plain
`cargo test` therefore ran it on the user's real screen. Take the display
from VOELIN_X11_TEST_DISPLAY instead, as the X11 hotkey test of
voelin-platform already does and as CI sets it under xvfb-run, so the
test only ever runs on a display made for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:50:24 +03:00
selikhovandClaude Opus 5.5 ef976cf31e Android: Share to Voelin
Other apps could not hand anything to Voelin. The activity now takes
ACTION_SEND and ACTION_SEND_MULTIPLE of any type. Text and links go into
the composer of the current chat, which the phone then shows: one tap
sends them, and a mis-tap in the share sheet does not post into a busy
channel. Files are copied out of the sending app while its content URIs
are readable (on a thread of their own, under the name the app gives,
made safe as a path component) and uploaded to the current chat's
channel, or the channel we are in, and linked there as the composer's
attach button does. The copies live in the cache and are removed at the
next start.

Two development switches show both platform requests without a phone:
VOELIN_OPEN=notification (a tapped voice notification) and
VOELIN_OPEN=shared:<text>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:48:38 +03:00
selikhovandClaude Opus 5.5 d4b6baaa42 Android: notifications that read like the app's voice bar
The voice service's notification said "In voice on <server>" with Mute
and Disconnect, and the screen-sharing one only "Sharing your screen".
The voice notification now shows what the app's voice card shows: the
channel as its title, the server and how many are there ("Home · 3 in
voice", "just you"), the time in voice as a chronometer, and Mute,
Deafen and Leave, which act on every voice session as the old Mute did.
Several servers at once read "In voice on 2 servers" with their names.
Tapping it opens the voice channel screen (the activity forwards the
action to Rust, which queues it until the window runs). While our
stream is live the screen-sharing notification says where it goes and
how many watch ("Live in Chill Zone", "Home · 2 watching"). Both use
the app's accent colour.

The window takes such platform requests through a small inbox in
voelin-ui (`voelin_ui::request`), handled on the window's thread and
outside the app's borrow, since navigating calls back into Rust.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:17:38 +03:00
selikhovandClaude Opus 5.5 8519199c6b voelin-media: MJPEG cameras for the Stream Studio
Many USB cameras offer their large sizes only as MJPEG (the Fifine K420:
2560x1440 and 1920x1080 compressed, raw only up to 1280x720), and the
studio camera offered PipeWire raw formats only, so it was stuck at 720p.

MJPEG is now offered and decoded with zune-jpeg (already in the tree
through `image`) straight into pooled RGBA frames, on a thread of its own:
the camera thread copies each picture into a recycled buffer and hands it
over latest-wins, so a slow decode drops pictures instead of holding up
the camera, and nothing is allocated per picture once running. The offers
come from what V4L2 lists for the camera: the wanted size at the wanted
rate in a raw format first (no decoding), then the wanted size with MJPEG
first, then every format at the sizes it lists; PipeWire's V4L2 source
otherwise took a size on trust and failed to set NV12 at 1440p.

zune-jpeg is built optimised in dev builds like the other per-pixel code:
unoptimised, a 1440p picture took most of a second.

Tested on the Fifine K420: 2560x1440, 1920x1080 and 1280x720 arrive at
the right size at 10 fps, which is what the camera sends in this light
(v4l2-ctl measures the same); a camera-like 1440p picture decodes in about
30 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:07:44 +03:00
selikhovandClaude Opus 5.5 a8a2409cb8 Private chat tabs named after the peer; form, Library and phone fixes
A private chat's tab took the name of whoever wrote the first message
of a batch (our own name when we wrote first) or the raw unique id: it
is the peer's name now. The event form's fields keep together, the
Library shows sample recordings without the user's folder in sample
mode, and the phone's Friends page is not titled twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 13:57:08 +03:00
selikhovandClaude Opus 5.5 2a1279ee7b voelin-media: RTMP output for the Stream Studio through libavformat
The RTMP output was a seam that refused every rtmp:// URL. Broadcast
services (Twitch, YouTube, nginx-rtmp) take RTMP, so the studio could only
reach the few that speak WHIP.

The connection is libavformat's own rtmp:// and rtmps:// protocols,
loaded at runtime with the rest of FFmpeg and never linked. Its RTMP
writer takes an FLV byte stream and sends each tag as a message, so the
FLV is ours (onMetaData, AVC and AAC sequence headers, a tag per frame)
and no muxer struct (AVFormatContext, AVStream, codec parameters, which
all moved between releases) is used: five avio functions and
AVIOInterruptCB. Write errors only land in AVIOContext.error, which moved
too (120 bytes in libavformat 58, 84 in 63); it is found at load by
flushing a context whose write callback fails with a sentinel.

Video is the studio's H.264 of one layer as encoded; other codecs are
refused with the reason. Audio is the studio's Opus decoded and encoded
as AAC-LC by FFmpeg's own codecs on the output's thread. The encoder's
sample format has no AVOption, so AVCodecContext.sample_fmt is located
from its neighbours' option offsets like hw_frames_ctx; its 1024-sample
frames are a reference to the first decoded frame (FFmpeg filled in the
channel layout, whose field moved) with only the leading fields pointed
at our planes.

The stream key comes from the URL or the token (sent as the play path)
and never shows in the output's name. The first connection is made when
the output is added, so a wrong address fails there; later failures are
reconnected with backoff (1 s doubling to 30 s), each new connection
starting at a keyframe it asks for, and the stats show why it is down.
EndStream unpublishes; a dead network is cut off after three seconds.

Tested against FFmpeg's own RTMP server (ffmpeg -listen 1): a studio
stream through the hardware H.264 encoder and a 440 Hz tone arrives as
h264 320x180 and aac 48 kHz stereo per ffprobe, starts at a keyframe,
decodes, and comes back after the server is replaced; the unit tests
also pass against FFmpeg 4.4.8. voelinctl studio run gets --rtmp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 12:50:58 +03:00
selikhovandClaude Opus 5.5 5f51eb15a2 voelin-ui: the phone's voice channel screen, and Home as the mockups show
The phone had no voice channel view: the people, the streams and the
channel's chat were spread over three tabs, and watching replaced the
Chat tab with a bare player. The voice channel now has a screen of its
own (design mockup 02): the channel's name and topic with Leave, the
stream we watch with LIVE, viewers, quality, volume and full screen (or
a card to watch one), the people with talking and muted marks, crowns
and LIVE, an Invite button that copies a ts3server:// link to the
channel, the channel chat with its pins, topics and members, the
composer with hold-to-talk when push-to-talk is the transmit mode, and
Mute, Deafen, Go Live, Share and Leave in place of the navigation. It
opens from the top bar's voice button, the voice card, the Activity tab
and by watching a stream; back keeps a stream playing behind it.

The navigation: Home's server cards and Open went nowhere on the phone
(the Home tab stayed); a server now switches to the Servers tab. The
Chat tab is Chats and stays the chat while watching. The studio, like
the voice screen, goes without the bottom bar, as its mockup does. The
pins, topics and server members (beside the chat on the desktop) open
as pages over the phone's screen.

Home gains what mockup 01 has and the engine knows: who is online on
the current server, its chats with their last message and time (emoji
left out of the one-line preview), the servers (side by side on the
phone) and the streams of our channel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 12:48:08 +03:00
selikhovandClaude Opus 5.5 27b277adc4 Fit the home page on one screen; phone home and tabs; icon shapes
The home column is as tall as the window (banner, friends, live rooms,
servers and recent chats), as in the design. On the phone the friends
are smaller bubbles, the title says the app's name and the bottom
navigation marks Home while the home, friends, messages or Library page
is shown. One-line previews leave out emoji (plain text draws none).
Icons whose Lucide data spans several lines were written empty; they
are complete now. Sample contacts stay when the engine reports its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 12:47:37 +03:00
selikhovandClaude Opus 5.5 c7455977f6 Pictures in chat as inline cards; navigate after callbacks
A linked picture whose bytes arrived shows as a picture card in the
message (a click opens it larger) instead of the file card.

Navigating from the app (opening a conversation, a notification, a
search result) ran Nav's functions inside a callback, and Nav calls back
into the app, which was borrowed: the app panicked. Such navigation now
runs after the callback, as the Stream Studio's does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 12:29:25 +03:00
selikhovandClaude Opus 5.5 6cfec67eee voelin-ui: keep the demo studio's game capture clear of the LIVE badge
The sample studio's "Game Capture" is the synthetic test pattern, whose
frame counter is drawn large in its top-left corner, exactly where the
preview puts LIVE and the timer: the screenshots showed half-hidden
glyphs there. The sample source now crops the pattern's top 120 rows
away (it still covers the frame), and the studio screenshots are taken
again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 12:24:56 +03:00
selikhovandClaude Opus 5.5 0a96cf879e Let the Android clippy run pass: two thread_locals it misreads
`cargo ndk ... clippy -p voelin-android -p voelin-ui -- -D warnings`
stopped at missing_const_for_thread_local on the window's app state and
the audio input buffer, which are both `const` already: on Android
targets the macro expands so that clippy does not see the initializer.
Allowed locally, with that reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 12:24:56 +03:00
selikhovandClaude Opus 5.5 673e41542c Merge the Stream Studio UI
Both sides kept: the studio page and the new home, friends, messages,
events and settings pages in the Page enum, app.slint, the phone's top
bar (studio, search, bell), bind/ and vm/ modules, dev.rs switches. The
layers icon and Video::codecs were added on both sides; one of each is
kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 12:17:41 +03:00
selikhovandClaude Opus 5.5 331fee9c1a Sample data and switches for the new screens
VOELIN_DEMO_UI gains contacts on both sample servers, private chats
with pictures and files, a poke, notifications, gateway events (one
live), gateway settings and rules, and recordings; VOELIN_OPEN opens
friends, messages, inbox, library, events, the search, the bell, the
join dialog, an offline message, a picture and the camera preview,
and the new settings sections. Sample data never opens a real camera.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 12:00:27 +03:00
selikhovandClaude Opus 5.5 b8a111df1f Merge the Stream Studio UI
The studio inside the main window (scenes, sources, preview with LIVE,
timer and viewers, the audio mixer with meters and gains, stream chat,
stream settings with a simulcast layer editor, Share Window/Screen,
Record Clip, Go Live, End Stream), the same studio in its own window,
and a phone layout. Also an engine fix: a camera's new background
effect is applied instead of being kept from the old one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 11:57:48 +03:00
selikhovandClaude Opus 5.5 a6016aaf8f voelin-platform: don't show a test notification on a developer's desktop
notify_returns checks that a notification fails cleanly without a
notification service, but where a session bus and a notification daemon
exist it sent a real urgent "Poke: from a test" notification on every
test run. Skip it there, as the portal capture test already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 11:57:32 +03:00
selikhovandClaude Opus 5.5 c081476de9 Home, friends, direct messages, the bell, search, events and settings pages
The screens of design mockups 01, 02, 03 (server sidebar links) and 11
on the existing pattern (Bridge models synced row by row, view models
in vm/, callbacks in bind/), mapped onto what TeamSpeak has:

- Home: a banner with Voelin and each server, friends online from the
  sessions' presence, live streams of our servers (our channel, the
  gateways' directories, clients flagged streaming), the servers with
  Join, the latest chats across servers (history store), friend
  activity, quick actions (add, join by address, find friends) and
  what is happening (gateway events, scheduled streams, server news).
  The Library lists the Stream Studio's recordings and clips.
- Friends: contacts with where they are, message, poke, join, watch,
  relation, note, volume and mute.
- Direct messages: private chats of every server and of the store,
  pokes among the messages, a clear state when the peer cannot be
  reached, TS3/TS6 offline messages (list, read, send, delete).
- The bell (mentions, pokes, messages, event reminders, friends coming
  online; a setting per kind, desktop notifications), the Ctrl+K
  search (servers, channels, people, settings pages; keyboard).
- A server's events page (RSVP, attendees, create/edit/delete,
  scheduled streams) and the Events/Members entries above the tree.
- Inline pictures in chat (downloaded into memory up to
  ui.image_preview_kb, decoded once into the image cache).
- Settings: My Account, Profiles (identities: default, rename, delete,
  export, import from the official clients, security level on every
  core, identity per bookmark), Appearance, Voice & Video (camera
  preview with blur, video and stream quality, streaming permissions),
  Streaming (defaults, simulcast layers, audio sources), Devices,
  Notifications, Privacy & Safety, Keybinds, Integrations (gateways,
  gateway administration, encoders) and Advanced (SRTP order, history,
  cache, every setting as JSON).

The top bar's field now opens the search instead of filtering the
channel tree; the search finds channels of every server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 11:56:06 +03:00
selikhovandClaude Opus 5.5 55ac7166eb Describe the Stream Studio screen in docs/ui.md, with screenshots
What each part shows, how it opens for a screenshot and what of the
engine it uses; how the window of its own shares the controller; the
studio.ui setting; the sample studio; its limits. docs/studio.md points
there and says that another background effect restarts a source's
input. The headless example also drops XDG_SESSION_TYPE, as the script
now does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 11:50:36 +03:00
selikhovandClaude Opus 5.5 81eca6236f Merge the zero-copy GPU path for screen capture
A captured RGB DMA-BUF is converted to NV12 and scaled per simulcast
layer on the GPU, into surfaces the VA-API encoders take as they are;
the CPU never reads the frame. Used while every layer's encoder is
VA-API, with the unchanged CPU path otherwise, and switched on the fly.
The portal offers the GPU's tiled layout ahead of LINEAR. Measured with
the test pattern as DMA-BUFs: 1440p60 h264_vaapi at 0.10 cores instead
of 0.34-0.52; a real portal capture through this path is still to run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 11:48:21 +03:00
selikhovandClaude Opus 5.5 fe598e67e8 voelin-ui: keep the stream chat right when its tab is not shown
Since the chat keeps a session's stored messages as the truth, the main
window builds lines only for the tab it shows, and the stream chat shared
that tab's lines: when the stream's channel was not the shown tab its
chat stood still, and a line pushed by hand (the sample data's go-live
message) was gone at the next refresh. The studio now has its own lines,
made from the destination tab's messages the way the chat view makes
them, and the chat tells it when that tab gets messages. The sample data
posts its go-live message as a stored message, as the engine's echo
would arrive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 11:47:27 +03:00
selikhovandClaude Opus 5.5 c24546dd26 voelin-core: drop the frame a failed GPU conversion leaves behind
When a conversion failed, the sink had already counted the frame and
taken its layers' pacing, then declined it: the portal mapped it, the CPU
path counted it a second time and found no layer due. Drop that one
frame instead; the next one takes the CPU path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 11:47:20 +03:00
selikhovandClaude Opus 5.5 3f9d81ebc0 docs/media.md: the streamer's GPU path, and what it costs
Describe how captured DMA-BUFs now reach VA-API encoders (the GPU path in
the pipeline, GpuConverter and GpuFrame, encode_gpu, the portal's tiled
offer and renegotiation, synthetic_dmabuf and `bench --dmabuf`), and
record the release measurements of the whole streamer on both paths with
the test pattern handed over as DMA-BUFs:

- 1440p60 h264_vaapi: 0.10 cores against 0.34-0.52, every frame on the
  GPU, 2.0-2.7 ms of the capture thread waiting for it;
- simulcast 1440p30 + 720p30 + 360p15: 0.06 cores against 0.26-0.38;
- 1080p60 av1_vaapi: 0.06 cores against 0.29.

The verification table gains the new tests, and says plainly that the
GPU path has not met a real portal capture yet, nor the tiled offer a
compositor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 11:45:20 +03:00
selikhovandClaude Opus 5.5 055f74059f voelin-ui: end screenshot runs that have the studio's window open
A screenshot run hid the main window and waited for the event loop to
end, which it does not while another window is visible: with the studio
detached the run never finished. It now quits the event loop itself.

The stream chat keeps scrolling to its end for a moment after a change:
rows are measured as they come into view, so the end moves while the
first scroll reaches it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 11:40:07 +03:00
selikhovandClaude Opus 5.5 a45e85de02 voelin-media: offer the encoder's tiled layout to the compositor
The portal asked for LINEAR DMA-BUFs only, because the CPU could not read
anything else. With the frames going to the GPU, a compositor that hands
over its own tiled layout saves itself a de-tiling copy per frame, and
the converter reads tiled memory faster.

FrameSink::dmabuf_modifiers lists the tiled modifiers a sink takes now;
the streamer's sink lists the GPU converter's (the layout the driver
gives its own RGB surfaces, which it imports: 0x200000028a01f04 on the
RX 7900 GRE) while the GPU path runs, and nothing on the CPU path. The
portal offers them ahead of LINEAR, picks the first one the compositor
can produce when it leaves the choice to us (LINEAR otherwise, as
before), and renegotiates whenever the sink's list changes: a switch to
an encoder that needs frames in memory, or a failed GPU conversion,
brings LINEAR buffers back before the CPU has to read one.

The first DMA-BUF of a capture is LINEAR (the converter is made for it),
and the offer is renewed from the second frame. Not tested against a
compositor: that needs a portal capture, which asks the person at the
desktop. The offer and the choice are unit-tested.

Also: exact_size tolerates an alignment of 0 (a stopped layer reports
one), which divided by zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 07:52:42 +03:00
selikhovandClaude Opus 5.5 f317153203 voelin-core: screen capture DMA-BUFs go to VA-API encoders on the GPU
The streamer's sink never took DMA-BUFs, so every captured frame was
read by the CPU, converted to I420 on every core and uploaded again for
a VA-API encoder; on a discrete GPU reading the buffer alone cost 19.5
cores at 1440p60 until the portal fell back to shared memory.

Ingest now takes DMA-BUFs whenever every encoder of every layer takes
GPU frames: on the capture thread one GpuConverter call converts the
buffer to NV12 and scales it for each layer that is due, straight into
surfaces of our own, and returns once the GPU is done, so the buffer goes
back to the compositor at once. Each layer's frame travels through a
second handoff to its encoder thread, which waits on both inboxes and
encodes the surface as it is (encode_gpu). The CPU path stays as it was
for everything else, and the capture switches to it by itself:

- an encoder that needs frames in memory (libvpx, x264, or an encoder
  made for a viewer of another codec) sets its layer's GPU alignment to
  0, so Ingest declines the next DMA-BUF and the portal maps it; until
  then such an encoder skips GPU frames and starts with a keyframe;
- a conversion that fails turns the GPU stage off for the capture, with
  the reason in StreamerStats::gpu_error.

Each layer's encoders publish the largest alignment they need, so the
GPU makes frames at sizes they encode exactly (AV1 on RDNA3 included).
A still screen's last GPU picture is sent again with a new timestamp
through another reference to its surface (GpuFrame::at).

StreamerStats gains gpu_frames, gpu_convert_time and gpu_error, and
`voelinctl stream bench` prints both paths; its new --dmabuf hands the
test pattern over as DMA-BUFs (StreamerConfig::synthetic_dmabuf), which
drives this path without a portal. Measured there (debug build, 720p30,
h264_vaapi): every frame on the GPU, 0.90 ms per frame on the capture
thread, 0.02 cores for the whole process.

Test: two simulcast layers through h264_vaapi take the GPU path for every
frame at their own sizes; a switch to libvpx takes the CPU path again
and the stream decodes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 07:47:47 +03:00
selikhovandClaude Opus 5.5 06a4dd410b voelin-ui: keep the studio to one stream and one window where needed
A session has one stream of ours: a quick share now refuses to start
where the studio is live, as Go Live already refused where a share runs.
Android runs one window, so the studio cannot be detached there (a wide
tablet shows the desktop layout and its detach button). The studio's
window sets the standard widgets' colour scheme from its theme, as the
main window does, and the dialogs keep their fields under their labels.

Headless screenshots also drop XDG_SESSION_TYPE: with it the push-to-talk
hotkey (and screen capture) pick the desktop portal of the user's
Wayland session even on Xvfb, which can ask the real desktop to bind a
shortcut.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 07:46:27 +03:00
selikhovandClaude Opus 5.5 1bf305cf3c voelin-media: the test pattern can arrive as DMA-BUFs, as the portal sends
The DMA-BUF path of a capture sink could only be driven by the ScreenCast
portal, which needs a person to answer its dialog. SyntheticScreen gains
with_dmabuf: it draws into a DMA-BUF of ordinary memory (a sealed memfd
shared through /dev/udmabuf, LINEAR XR24) and offers it to sinks that
take DMA-BUFs, as the portal does; a sink that declines gets the same
memory as a frame. Without /dev/udmabuf it says why and draws into
memory as before.

The udmabuf code moves from the encoder's test into capture/dmabuf.rs
(Udmabuf), which the test now uses as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 07:37:49 +03:00
selikhovandClaude Opus 5.5 bbc0aa5c54 Merge the hardware encoder probe fix into the Stream Studio branch
The development head now keeps AMF's runtime from crashing the app while
it probes the encoders; nothing of it overlaps the studio.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 07:35:50 +03:00
selikhovandClaude Opus 5.5 b8eb5e7b65 voelin-ui: bring the studio screens closer to the design
Seen next to the mockups: the preview's corner badges sat at the left
(a positioned layout takes its parent's width unless told otherwise), the
bottom bar cut "Share Window" short, the mixer and the chat took the
height the preview needed, the destination was one line where the design
shows the channel over the server, and the compact stream settings
spread over their panel. The preview's panel is now as tall as a 16:9
picture across its column, the badges keep to their corners, the chat
shows its newest lines, the destination is channel and server, and a
scene's summary names its main picture first.

The overlay sources start clear of the corners the studio's own badges
cover in the preview: the viewer count at the top right, what is on
above the bottom left. While live, Go Live stays bright instead of
looking unavailable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 07:35:38 +03:00
selikhovandClaude Opus 5.5 a1dae8565d voelin-media: GPU frames for every simulcast layer, encoded from their surfaces
The streamer's zero-copy path needs the conversion and the encoding on
different threads: the captured buffer has to go back to the compositor
at once, while each layer's encoder runs on its own thread. So split
what encode_dmabuf did in one call:

- GpuConverter (ffmpeg/gpu.rs), on the capture thread: maps an RGB
  DMA-BUF onto a VA-API surface and converts it with VA-API video
  processing into an NV12 surface per layer that is due, the whole
  picture scaled to the layer's size and cropped to its encoder's
  alignment. The surfaces come from pools of our own and travel as
  GpuFrames, which are recycled once nothing holds them, so nothing is
  allocated per frame once the pools are warm. It also reports the tiled
  modifier the driver gives its own RGB surfaces, for the portal to offer.

- VideoEncoder::gpu_alignment and encode_gpu: VA-API encoders take a
  GpuFrame's surface as it is (the encoder references it until it is
  done); every other encoder says it takes none.

encode_dmabuf's RGB path now goes through the same converter instead of
a second copy of the import and conversion in the session.

Checked on the RX 7900 GRE: h264_vaapi encodes surfaces from a pool
other than its own; the scaled 640x352 layer is 48.5 dB against the CPU
pyramid's picture and the full one 40.4 dB (Y identical, chroma within
0.7); each layer's surface decodes through OpenH264; frames come back
once released; the driver's tiled RGB modifier is 0x200000028a01f04.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 07:33:30 +03:00
selikhovandClaude Opus 5.5 76613d28c6 Engine pieces for the home, messages and settings screens
The home page lists the latest chats across servers and the profiles
page raises an identity's security level, so the engine gains:

- Store::recent_chats / History::recent_chats: the newest message of
  every chat, the most recently active first (one pass over the time
  index).
- identity::improve_level: the hash cash search on every core, in
  chunks of counters, cancellable, reporting each better level reached;
  the key and so the unique id stay the same.
- privacy.private_messages and privacy.pokes (everyone, friends,
  nobody): private messages and pokes of everyone else are dropped,
  next to what privacy.block_mode does for blocked contacts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 07:25:35 +03:00
selikhovandClaude Opus 5.5 7423b4ff30 Merge the fix for AMF crashing the app during the encoder probe
AMD's AMF runtime is not safe to open on several threads at once; the
probe did exactly that and crashed the app inside avcodec_open2. AMF
opens are serialised, and on Linux AMF is used only on request
(VOELIN_FFMPEG_AMF=1): VA-API drives the same encoder there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 07:22:01 +03:00
selikhovandClaude Opus 5.5 c5314f8691 voelin-media: keep AMF's runtime from crashing the app during the probe
The desktop app died at startup under Xvfb with SIGSEGV in libamfrt64,
inside avcodec_open2 while the encoder probe opened h264_amf, hevc_amf
and av1_amf on parallel threads. Reproduced with the probe alone: 10 of
420 runs crashed with four to eight processes probing at once, every one
in AMF's process-wide AMFFactoryHelper (Init, or Terminate dlclose-ing a
library) while AMFContextImpl::InitVulkan created an encoder's device.
Serialising AMF opens within the process removed it: none of 600 runs
crashed, with the processes still probing together. So the race is
between threads of one process, not between processes.

Two changes:

- AMF encoders are opened and closed one at a time in the process. That
  fixes the race wherever AMF is used: the probe, simulcast layers
  opening together, and Windows, where AMF is the AMD encoder.

- On Linux AMF is not used unless VOELIN_FFMPEG_AMF=1. FfmpegEncoder::new
  refuses it with the reason, so neither the probe, nor the factories, nor
  a direct caller loads the runtime at all. VA-API drives the same VCN
  encoder there, measured as fast with less CPU, and only VA-API takes
  DMA-BUFs without a copy; AMF on Linux is AMD's closed runtime on top of
  Vulkan, and a library that is never loaded cannot crash the app.

Not done: running the self-tests in a child process. A clean child does
not reproduce the state of the process that opens the encoder afterwards
(here the race only showed under load), so it would pass a backend that
can still crash the app, and every binary's main would have to cooperate.

Tests: the AMF refusal through FfmpegEncoder::new, the probe reporting
the reason without libamfrt mapped into the process, and an ignored
stress test that opens every AMF encoder on parallel threads 40 times
(with VOELIN_FFMPEG_AMF=1 it passes; the probe loop it replaces crashed).

On this machine the automatic H.264 encoder changes from h264_amf to
h264_vaapi.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 07:19:41 +03:00
selikhovandClaude Opus 5.5 55267f88bd Merge the server screens into the Stream Studio branch
Both sides added to Nav (the studio's open-studio next to the drawers and
the voice view), to App (the studio's state next to the uploads) and to
the development switches (studio[:...] next to voice, pins, topics,
watch); all of them are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 07:14:20 +03:00
selikhovandClaude Opus 5.5 0b58284019 voelin-ui: drive the Stream Studio from the engine
The studio screens now run on the engine's studio: scenes and sources
are its scene graph (switch, add, rename, remove, reorder, show, lock,
transform, crop, opacity, background effect), the preview is its preview
tap turned into pictures on a thread of its own (latest wins, so a busy
UI skips frames instead of holding up the composite), and a Streamer
started for it encodes the composite from the start, so Record Clip and
recordings work before going live. Going live starts a TeamSpeak stream
in our voice channel and attaches that streamer to it, then tells the
studio; viewers, requests and the connection quality (the viewers'
bandwidth estimates and the composed frame rate) show in the header.

The audio mixer is stream.audio_sources with the mixer's meters, read
lock-free about 15 times a second; a gain drag goes to the mixer at once
and is stored at the end. The stream settings are a new studio.ui key;
title, game and go-live message, and three switches that keep overlay
text sources (viewer count, chat, now playing) in the live scene. The
game goes into the stream's name, which is all a TeamSpeak stream has
and what the gateway's directory shows. Layers, bitrate and output size
are the stream.* and studio.* keys, followed while streaming.

The detached window has its own globals; the same models are set on
both and both are wired to this controller. With VOELIN_DEMO_UI the
studio runs from synthetic sources and tones on settings in memory, and
VOELIN_OPEN=studio[:window|live|record|<dialog>] opens each state for
screenshots, which now also capture the studio's window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 07:07:12 +03:00
selikhovandClaude Opus 5.5 231f9d816b Merge the server screens of the new design
Chat with author grouping, reactions, file cards and the composer;
a resizable members panel grouped by server group with badges and a
member card; pinned-message and topic drawers; the voice-channel grid
with stream cards; the watch-stream screen with viewers, volume, chat
and a full-window pop-out. Screenshots run headless on Xvfb with
WAYLAND_DISPLAY removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 07:07:08 +03:00
selikhovandClaude Opus 5.5 b64f210975 Describe the server page in docs/ui.md; screenshots of its final state
docs/ui.md gains a section on the server page: each part (chat, members
panel, member card, pins, topics, voice channel, watching a stream), the
`VOELIN_OPEN` switch that shows it, and the engine events and requests
it uses. The settings table lists `ui.members_width`, the switches and
the screenshot script are described as they now work, and the limits say
what the design shows that we leave out (offline members, a quality
picker without layer information, a second window for the pop-out).

The screenshots are taken again so they all show the chat at its newest
message. The user card's avatar has the green ring while our voice goes
out, the speaking indicator of the compact voice controls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 06:56:37 +03:00
selikhovandClaude Opus 5.5 852b021a5f tsclientlib: keep its tests from failing in a chain on test order
The tests share a tracing setup in a Lazy that called init(). When the
quickcheck test ran first, its logging (use_logging) had already
installed a log logger, init() panicked with SetLoggerError, the Lazy
was poisoned and every later test of the binary failed. Use try_init().
Recorded as local patch 10 in UPSTREAM.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 06:56:07 +03:00
selikhovandClaude Opus 5.5 4e56c15505 Merge the GPU validation of the hardware video path
Measured on a real RX 7900 GRE with FFmpeg 9: VA-API and AMF encode
1080p60 and 1440p60 at a quarter to half a core, simulcast included;
RGB DMA-BUFs are converted to NV12 on the GPU; Wayland screen capture
delivers frames again (it delivered none) and switches to shared memory
where reading GPU memory is slow; the H.264 level of the SPS matches
the offer; AV1 is cropped to what this GPU really encodes; FFmpeg 9's
structure offsets are checked against its headers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 06:55:32 +03:00
selikhovandClaude Opus 5.5 71d9701c56 voelin-ui: open chats at the newest message, and jump to pins
Nothing set the position of the message list, so a chat opened at the
oldest loaded message and new ones arrived out of sight below. The list
now starts at its end and follows new messages while it is there;
scrolling up stops that until the end is reached again, and another tab
starts at its end.

Jumping to a pinned message highlighted it but did not scroll: it now
scrolls to the message (to where an average row would be, as the
standard list estimates it, since rows differ in height) and leaves an
open topic for the chat.

The members panel could be dragged no wider than 420 px; it can now
take what the window allows while the chat keeps 400 px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 06:49:46 +03:00
selikhovandClaude Opus 5.5 3f838c6bb7 voelin-media: apply a camera's new background effect
A source's input was kept when its background changed as long as both
the old and the new effect needed a mask, but the background filter is
set up with its effect when the input starts. So switching a camera from
blur to a colour or an image, or changing the blur strength, changed the
scene and nothing on screen. The input now restarts whenever the effect
differs, as it already did when the effect went on or off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 06:44:55 +03:00
selikhovandClaude Opus 5.5 68abbcf20b 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