Commit Graph
296 Commits
Author SHA1 Message Date
selikhovandClaude Opus 5.5 686787f33c Log once when the last decoder of a ladder keeps failing
A stream no decoder here takes would otherwise warn every three
failures for as long as it is watched; the first time says it all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 23:34:40 +03:00
selikhovandClaude Opus 5.5 1f7967cc9b Measure AV1 at 1440p60 through every AV1 decoder
The official client sends AV1 from GPUs that encode it, so the decoders'
measurement covers it too: streams from av1_vaapi (hardware, as the
official client's AMF) and SVT-AV1 at 2560x1440 and 60 fps, decoded by
every decoder of the AV1 ladder and compared with dav1d's pictures. All
600 pictures from each, the same: av1_vaapi 301-309 fps, libdav1d (8
threads) 412-426 fps, libaom 240-286 fps (release build, RX 7900 GRE,
FFmpeg 9.0.1). The H.264 measurement shares the helpers now, and its
table in media.md gives the range of two runs on a desktop in use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 23:33:33 +03:00
selikhovandClaude Opus 5.5 44d674cf0d docs: FFmpeg's decoders, the ladder, what a viewer accepts now
media.md describes the decoders (hardware through FFmpeg's hwaccel API,
then FFmpeg's software ones, then the built-in ones), hw_device_ctx and
how it is found, the self-test clips, the ladder on this machine, the
settings, the pipeline's fallback and loss recovery, the measurements of
H.264 with B-frames at 1440p60, and what was tested where (VA-API on the
RX 7900 GRE, the browser interop; NVDEC, D3D11VA, DXVA2 and VideoToolbox
only type-checked or not at all). The protocol notes say what Voelin now
accepts from official streamers and why their H.264 decoded so badly
before (OpenH264 and B-frames).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 23:28:50 +03:00
selikhovandClaude Opus 5.5 65d0a3abf6 Merge claude/gifted-lovelace-1crlx2: Wave 5B (Android, phone, quick share's sound)
The conflicts were in the app: the settings a running window follows (the
quick share's audio sources, now also the decoder settings) and the
imports of video.rs; both keep both sides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 23:26:17 +03:00
selikhovandClaude Opus 5.5 8612b85518 Test that FFmpeg's decoders allocate nothing per picture
decode_into reuses the caller's frame and the decoder's own download
frame, so a running decoder should make no Rust allocation per picture.
A counting global allocator (as the mixer's and the studio's tests have)
checks it for every decoder that passed its self-test, the VA-API ones
included: here av1_vaapi, hevc_vaapi, vp9_vaapi, h264_vaapi, libdav1d,
libaom-av1, hevc, vp9, h264 and vp8 make none over 30 pictures at
640x360. FFmpeg's own buffers are its mallocs and its pools.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 23:20:49 +03:00
selikhovandClaude Opus 5.5 7975645e6a voelin-media: build the RTMP output without FFmpeg again
The Android check of voelin-media without default features failed after
Wave 6A: RTMP's queue, backoff, backlog and interleave constants and the
queued packet's fields are only used by the FFmpeg session, so without the
`ffmpeg` feature (where RTMP only refuses) they were dead code. The
constants are now compiled with the feature only, and the packet struct
says why its fields go unread without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 23:20:29 +03:00
selikhovandClaude Opus 5.5 d715444abd Merge Wave 5B: the phone, Android, and the quick share's sound
The phone's voice channel screen (mockup 02), Home and bottom navigation;
Android cameras through Camera2, the screen shared into MediaCodec's input
surface without a copy, notifications with working actions, "Share to
Voelin"; the multi-select audio picker with app icons; and, asked by the
user, the quick share's sound: the share dialog shows the studio's mixer
rows (meter, gain, mute) for `stream.audio_sources` and its picker, and a
running share follows changes live. docs/android.md rewritten.

Conflicts: both waves gave studio cameras a new backend (Windows Media
Foundation from Wave 6A, Android Camera2 here); both are kept, in the
docs and code. The Windows build caught what the merge could not: each
side's `Capture` initializers lacked the other's field, and Media
Foundation cameras lacked `Camera::mirrored` (webcams face the user, so
true). Checked: fmt, clippy (host, x86_64-pc-windows-gnu for voelin-media,
both Android runs), and the tests of stream, media, core, ui, android and
voelinctl.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 23:20:29 +03:00
selikhovandClaude Opus 5.5 543c8960b2 Interop: Chromium's AV1, VP9 and H.264 decode in the engine's pipeline
The official client sends AV1 from modern GPUs, and H.264 after it
re-aligns; nothing checked that our viewer takes what a libwebrtc sender
produces. Headless Chromium now offers its canvas in AV1, VP9 and H.264
in turn to our viewer peer, configured with peer_config like a watch
(accepting what this machine decodes), and a VideoPipeline must decode
30 pictures of each at the canvas's size with the first decoder of the
codec's ladder, keyframe requests going back as PLIs.

Chromium 152 (Arch Linux, VOELIN_CHROMIUM=/usr/bin/chromium) sends all
three; here they decode on the GPU (av1_vaapi, vp9_vaapi, h264_vaapi).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 23:19:08 +03:00
selikhovandClaude Opus 5.5 200b715b9e voelinctl stream encoders: list the decoders and each codec's ladder
The report has the decoders now: print them like the encoders, with
their self-test results and rank, and the order a viewer tries each
codec's decoders in. --decoder and --no-hardware-decoding rank them as
the settings stream.decoder_backend and stream.hardware_decoding would.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 23:15:36 +03:00
selikhovandClaude Opus 5.5 338fb1c117 Measure H.264 with B-frames at 1440p60, through the decoders and the pipeline
Watching the official client's stream (H.264 from AMF at 2560x1440 and 60
fps, with B-frames and rare keyframes) had a very bad frame rate in the
app, which decoded it with Cisco's OpenH264. Two ignored measurements
reproduce such a stream with the ffmpeg command (x264 with 3 B-frames,
h264_vaapi with 2, ten seconds of testsrc2 at 8 Mbit/s, keyframes every
ten seconds).

ffmpeg_decoders.rs decodes it with every H.264 decoder as fast as it
goes. Release build, RX 7900 GRE, FFmpeg 9.0.1, OpenH264 2.6.0:

  h264_vaapi  398-424 fps, slowest frame 4.0-6.8 ms, every picture
  h264        276-302 fps, slowest frame 6.6-8.0 ms, every picture
  openh264    8 of 600 pictures, 592 errors: it does not decode B-frames

Both FFmpeg decoders give the same pictures (thumbnails compared), in
order.

decode_rate.rs plays it in real time into a VideoPipeline whose consumer
converts every picture to RGBA as the app does:

  ladder (h264_vaapi), no loss:                59.9 fps
  ladder (h264_vaapi), a frame lost a second:  58.9 fps (concealed)
  OpenH264 alone, either way:                  0.8 fps

So the frame rate was OpenH264 failing on every B-frame and the pipeline
then waiting for keyframes; with FFmpeg's decoders first in the ladder
the stream plays at its full rate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 23:14:11 +03:00
selikhovandClaude Opus 5.5 289e7d4e6b Fall back to the next decoder at runtime; recover from losses
A watched stream now decodes with the best decoder of its codec and,
when it fails, with the next of the codec's ladder, without ending the
watch: three failures in a row (errors, or ten frames without a picture)
replace it, the keyframe that failed starts the next one at once, and
otherwise a keyframe is asked for. Each switch is logged with its reason,
and DecodeStats tells the decoder in use.

The official client's H.264 has B-frames and rare keyframes, and the
pipeline dropped every frame after a loss or an error until the next
keyframe, which such an encoder seldom sends. Decoders that conceal what
a loss leaves missing (FFmpeg's H.264 and HEVC) now go on decoding while
a keyframe is asked for; the others still skip to it. Whenever one is
wanted it is asked for again every half second until it comes, also
while no frame arrives, instead of once per skipped frame.

Pictures come from a small pool and go to the callback as
Arc<VideoFrame>: decoders write into a free one (decode_into), and a
consumer that converts and drops each picture, as the app does, costs no
allocations.

Settings stream.hardware_decoding and stream.decoder_backend choose the
decoders like the encoder settings (decoder_preference); the app applies
them when they change, to streams watched from then on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 23:02:48 +03:00
selikhovandClaude Opus 5.5 66a2b8329b Decode with FFmpeg at runtime: hardware first, then software
Watching an official client's stream failed partly because the app
decoded too little: no AV1 (the official client prefers it on modern
GPUs), and H.264 only with Cisco's OpenH264 downloaded. FFmpeg, already
loaded at runtime for the encoders, now decodes too, never linked or
shipped: the platform's hardware decoders through FFmpeg's hwaccel API
(VA-API and NVDEC on Linux, D3D11VA and DXVA2 on Windows, VideoToolbox on
macOS) for AV1, HEVC, VP9, H.264 and VP8, then FFmpeg's software ones
(dav1d, libaom, its own HEVC, VP9, H.264, VP8).

Hardware decoders get AVCodecContext.hw_device_ctx, located next to
hw_frames_ctx from the AVOption offsets of its neighbours and checked in
a new context like the encoders' fields; FFmpeg's default get_format
then picks the device's surfaces. Pictures are copied out of the GPU
into a frame of our own and into the caller's VideoFrame through the new
VideoDecoder::decode_into, both reused, so a running decoder allocates
nothing per picture on our side. Slice threads only and dav1d with a
frame delay of one keep the latency at zero.

A self-test per decoder, run once per process in parallel with the
encoders' probe, decodes a three-frame clip of each codec made by our
own encoders (src/ffmpeg/clips): each picture at once, at its size,
above 30 dB against the test picture, and on the GPU for a hardware
decoder, since FFmpeg silently decodes in software when the GPU lacks
the codec (VP8 on AMD).

Codecs now orders a ladder per codec (decoders_for): hardware, FFmpeg's
software decoders, then the built-in libvpx, OpenH264 and dav1d, under a
DecoderPreference like the encoders'; decoders() lists every codec one of
them decodes, best first (AV1, HEVC, VP9, H.264, VP8). The report lists
the decoders too. Tested here (RX 7900 GRE, FFmpeg 9.0.1): VA-API decodes
AV1, HEVC, VP9 and H.264 on the GPU, and every encoder of the machine
decodes with every decoder of its codec above 36 dB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:59:03 +03:00
selikhovandClaude Opus 5.5 75cd846a45 docs: the studio screenshots as the studio looks now
They were taken before the Share button's menu took over from the
separate Stream Studio buttons and before the phone's studio lost the
bottom bar, so they showed a top-bar button that is gone, the bar and
the old Chat tab. Taken again headless (desktop 1440x1000, its window
1600x1000, phone 390x844 and 390x1250).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:57:08 +03:00
selikhovandClaude Opus 5.5 7a404a439d Android: build with the build-tools the workflows install; this wave in the docs
The release workflow and the Docker build install build-tools 36.0.0, as
docs/android.md asks, but AGP 8.13 wanted its default, 35.0.0: it
installed that one itself where the SDK licences were accepted, and
elsewhere the build stopped. app/build.gradle.kts now pins 36.0.0, and
the debug APK (arm64-v8a and x86_64) builds with an SDK that has only
platform 36, build-tools 36.0.0 and the NDK 27.3: the Gradle 8.14.3
wrapper on Temurin JDK 17, Kotlin without warnings.

docs/android.md had none of this wave: the voice notification as the
app's voice card (Mute, Deafen, Leave, tap to open the voice screen), the
live stream's notification, the screen drawn straight into the encoder's
input surface and the reader for simulcast, the app picker with icons,
Camera2 cameras with the CAMERA permission, Share to Voelin, what was
tested where (the Rust sides, headless screenshots, compile-only parts),
a known gap (no camera foreground service) and how to try it on Waydroid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:56:58 +03:00
selikhovandClaude Opus 5.5 a61d0af370 voelin-ui: pick and mix the quick share's sound as the studio does
The "Share screen" dialog had one switch for sound, "Share system audio",
which shared whatever stream.audio_sources held: changing what the
stream carries (an application, the microphone, desktop audio without
Voelin) or how loud meant the Stream Studio or the settings, and a
running share never followed.

The dialog now shows the studio's audio mixer while the switch is on
(off still means no audio at all): the studio's MixerRow for each source
(meter, gain, mute, the menu) and Add, which opens the studio's
PickDialog over the dialog to switch several sources on and off. They
read the main window's StudioBridge, filled without starting the studio
(App::mixer_show). Starting a share hands the sources with their gain
and mute to the capture (CaptureRequest::audio_sources); the stream
announces sound only when there is some. While it runs, the dialog
shows the same rows with the share mixer's meters, about 15 times a
second (the share keeps the timer), and every change of
stream.audio_sources, from the dialog or anywhere else (the settings
change event), goes to the running capture at once through
Capture::follow_audio, which reconfigures the streamer. A share started
without sound has no audio track, so the dialog says so instead.

The studio's rows and meters follow whichever streamer goes out: a quick
share's while one runs, else the studio's encoder. The picker's
application list is let go once neither the dialog nor the studio needs
it. With sample data, VOELIN_OPEN=share:live shares the test pattern
with the sample studio's sources, live at once with sample viewers, and
Stop ends it, as the studio's demo does. On a phone the frame-rate and
bitrate fields of the dialog no longer run past its edge.

Tests: capture_request carries the picked sources with gain and mute,
and nothing with the switch off or no sources; a running capture on the
test pattern follows changed sources, keeps a silent track when all are
removed, and one started without sound stays so. Headless screenshots
of the dialog before and during a share, 1440x900 and 390x844.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:45:17 +03:00
selikhovandClaude Opus 5.5 228ba1a62b voelinctl: subscribe to every channel for stream list and watch
The new smoke step (a viewer in the default channel watching a stream in
another channel) failed: `voelinctl stream watch` waited forever. Unlike
the app's engine and voelinctl's tree and repl, the stream commands never
subscribed to the other channels, and the server shows a client, and so
its streaming flag, only in subscribed channels; discovery never learned
there was a stream to look up. They now subscribe to every channel on
start, as the engine does.

Checked on the TS6 dev server: a viewer in the default channel received
and decoded 60 pictures (1280x720) of a stream in `smoke-elsewhere`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:27:35 +03:00
selikhovandClaude Opus 5.5 acbb8c1124 Merge the development branch: streams of every channel
Brings in the streams of every channel (StreamItem::channel, the streams
panel listing other channels' streams after ours, the viewer's channel)
and the answer to a streamer's new offer.

streams.rs keeps both of the viewer's new values: whether the streamer
is an admin (this branch) and the stream's channel (the development
branch). The phone's pieces that list Bridge.streams now say where a
stream of another channel is: the voice screen's stream cards ("Lumen ·
in Gaming") and Home's Live now cards, whose comment and the server
rail's live flag no longer claim they are about our channel only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:24:13 +03:00
selikhovandClaude Opus 5.5 3bd230767c Merge Wave 6A: studio outputs, cameras, viewer counts and layers
RTMP output for the Stream Studio through libavformat (any stream codec,
pushed as H.264 + AAC; tested against `ffmpeg -listen 1`, ffprobe checks),
MJPEG cameras (decoded off the capture thread), TeamSpeak 6's own viewer
counts (`viewer` of `notifystreaminfo`, refreshed round robin), a viewer
quality picker for Voelin streams (`a=x-voelin-layers` in the offer, an
`x-voelin-layer` signal only Voelin streamers get), viewer-side stats over
the player, Windows cameras through Media Foundation (compile-checked
only), and the docs for all of them.

Merged cleanly with server-wide stream discovery and renegotiation; the
viewer-count refresh now covers every channel's streams. fmt, clippy and
the tests of stream, media, core, ui and voelinctl pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:18:38 +03:00
selikhovandClaude Opus 5.5 203921b647 voelin-ui: the phone's Go Live reads Live while the studio streams
The voice screen's Go Live button said "Go Live" while the Stream Studio
was live, as it only followed a quick share: it now reads "Live" for
either.

The phone screenshots in docs/screenshots are taken again for this
wave's screens: the voice channel with the stream on top (mockup 02),
the Activity tab, and Home, Servers, Chats, You and Settings with the
header's voice button and the bottom bar as they are now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:14:58 +03:00
selikhovandClaude Opus 5.5 379eeb355f Answer a streamer's new offer on the running connection
Watching a stream from the official client failed. Its log shows why:
after our answer it decided our codec choice did not suit it ("remote peer
is using unsupported codec, realign") and sent a new offer on the same
connection, a renegotiation. Voelin answered every offer with a new peer:
new ICE credentials, new DTLS fingerprint (the official client logged both
answers, they differ), so the connection the official client kept using
was gone and no picture came.

- `Peer::renegotiate` answers a new offer on the running peer (str0m
  `accept_offer` on the same Rtc): same ICE credentials and fingerprint.
- The viewer uses it for an `offer` signal while it has a connection; a
  `reconnectOffer` still starts a new one.
- str0m answers a renegotiation in the codec order the connection was
  built with, so a streamer re-offering another codec first kept sending
  the old one; `order_like_offer` puts the answer's payload types in the
  new offer's order.

Tests: a unit test (a str0m offerer adds audio in a new offer; same ICE
credentials and fingerprint, audio answered) and the order helper; the
browser interop test `browser_renegotiates_with_rust` (Chromium streams
VP8, re-offers VP9 on the same connection, VP9 frames arrive), passing
with Chromium 152.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:13:31 +03:00
selikhovandClaude Opus 5.5 f61c34b42c Find and watch streams in every channel, without a gateway
The server announces a stream only to the clients in the streamer's
channel. Voelin looked up streams that started before it joined
(`requeststreaminfo`), but only in its own channel, so a stream anywhere
else on the server appeared only through a gateway's directory. The
official client lists and joins them without one: `requeststreaminfo`
answers from any channel, and a `joinstreamrequest` from another channel
reaches the streamer (confirmed on the TS6 dev server with the probe).

- Discovery follows every streaming client on the server: it looks up
  the streams of clients in other channels as soon as they stream, keeps
  them when we or they change channels, and drops them when the streamer
  stops or leaves.
- The streams panel lists every channel's streams, ours first, the
  others with their channel ("by X · in Gaming"); clients still being
  looked up show in any channel. The viewer's note names the stream's
  channel instead of claiming it can only be watched from there.
- As a streamer with `stream.permissions = channel` (the default), our
  channel is let in and viewers from other channels are asked, as the
  setting's description ("who may watch without being asked") says;
  they were refused before.

Tested: discovery unit tests for the new rules; the engine's permission
test; the app headless (no gateway) on the TS6 dev server found and played
a stream in another channel and one that started before it joined;
scripts/it-smoke.sh gains a step where a viewer in the default channel
watches a stream in another channel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:01:10 +03:00
selikhovandClaude Opus 5.5 698e5f911e Merge the development branch: share menu, codec order, segmentation
Brings in the Share button's menu (Share screen / Stream Studio) and the
removal of the separate Stream Studio button from the headers, the
codecs every TeamSpeak client decodes ahead of H.264, the portal fix
and person segmentation.

The phone header keeps this branch's voice-channel button and hides the
bell on the voice screen, and loses the Stream Studio button as the
development branch wants. The studio's test table takes the
segmentation rows and the Android camera row. MediaCodec follows the new
codec order with no code change (Codecs orders every hardware factory's
codecs); its description and docs/media.md now say so, including what
that means on a phone without a hardware VP8, VP9 or AV1 encoder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 20:02:47 +03:00
selikhovandClaude Opus 5.5 114eafafd7 docs/studio.md: the Android cameras
The Camera2 provider landed without its description in the studio's
docs: how its frames reach a camera source (YUV_420_888 planes borrowed,
gathered into I420 only when turned or NV21), mirroring by default for
cameras facing the user, Switch camera, and what was tested where.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 19:51:45 +03:00
selikhovandClaude Opus 5.5 c79bb7dd07 Android: share the screen into the encoder without a copy
Screen sharing went MediaProjection -> ImageReader -> an owned Vec per
frame -> RGBA to NV12 on the CPU -> MediaCodec's input buffers: two
copies and a conversion of every frame on a phone's CPU.

Now, while it is the only MediaCodec encoder in the process (one
simulcast layer, one codec), an encoder takes GpuFrames: for the first
it starts a codec with an input surface (COLOR_FormatSurface,
max-fps-to-encoder at the stream's rate, repeat-previous-frame-after so
a still screen answers keyframe requests) and publishes it, and the
capture points its virtual display at that surface, resized to the
layer's size. The compositor renders the screen into the encoder; a
ticker at the stream's rate hands the sink GpuFrames that only collect
what the codec encoded, on the capture's timeline.

Simulcast keeps working by falling back: a second encoder (another
layer, or another codec a viewer chose) turns the path off for every
encoder and the display goes back to the reader, until it is the only
one again. One display can only render into one surface, and a GL
fan-out to several encoder surfaces is a lot of code for a case phones
rarely need. An encoder whose surface fails stays on frames in memory.

The fallback path no longer copies either: the provider's start_sink
hands the reader's buffer to the stream's sink borrowed. A frame-rate
change restarts the surface codec (its cap is fixed when it starts),
and the display is detached while it is resized, so neither consumer
sees a picture of the other's size.

Compiled for aarch64-linux-android only: there is no device here, so
frames per second and CPU use are not measured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 19:51:39 +03:00
selikhovandClaude Opus 5.5 9bff03e47c docs/media.md: the studio's cameras, RTMP and their dependencies
media.md still described the studio as recording, replay and WHIP, and
its dependency table did not list what the studio's MJPEG cameras
(zune-jpeg) and its person segmentation (tract-onnx with the bundled
PP-HumanSeg model) build on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 19:50:07 +03:00
selikhovandClaude Opus 5.5 5460927975 Merge branch 'claude/gifted-lovelace-1crlx2' into worktree-agent-a96f452184d5988cc
Brings in the portal dialog entry, the studio's person segmentation
(tract-onnx) and the Share button's menu. In docs/studio.md's status
table the segmentation rows join this branch's camera and RTMP rows
(RTMP is no longer a seam). docs/ui.md no longer says the engine cannot
tell a viewer the layers (a Voelin streamer lists them) nor that the
background effect has no segmentation model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 19:48:17 +03:00
selikhovandClaude Opus 5.5 ecc132f5ff Push a studio stream of any codec over RTMP, in H.264
Classic RTMP carries H.264 only, and the RTMP output refused a stream
encoding anything else. Since TeamSpeak streams now prefer the codecs
every client decodes before H.264, that refusal hit the usual case.

An output may now name a video codec of its own. The streamer then runs
an encoder of that codec for the layer the output takes, as it does for
a viewer that chose another codec, and hands those packets to the
outputs that asked for it only; recordings and the replay buffer keep
the stream's codec, which a studio now always encodes for them even
when every viewer chose another one. Only the output's layer gets the
extra encoder, not every simulcast layer.

Tested end to end: a VP8 studio stream pushed to FFmpeg's own RTMP
server arrives as H.264 and AAC (ffprobe), starting at a keyframe, while
a recording of the same stream stays VP8 and Opus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 19:42:02 +03:00
selikhovandClaude Opus 5.5 cacb023ccf voelin-ui: open the Stream Studio from the Share button
The studio had a button of its own in the top bar (and the phone's
header), apart from the Share button. The Share buttons (the voice
buttons on the desktop, Go Live on the phone) now open a small menu:
"Share screen", the quick share of a screen or a window as before, or
"Stream Studio". While a share runs they open its dialog directly, as
before; while the studio is live, "Share screen" is off and the button
shows the live state. The separate studio buttons are gone.

Checked headless on the demo UI: the menu opens above the button, and
each entry opens the share dialog or the studio.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:59:51 +03:00
selikhovandClaude Opus 5.5 02e43b14f9 Describe the layer picker's live run and what to check with the official client
A real two-layer VP8 stream of the test pattern through the TeamSpeak 6
dev server: the viewer asked for layer 1 and decoded 640x360 pictures at
an estimate that fits layer 0. The manual matrix gets ST6, the check that
needs the official client: it watches a stream whose offer carries the
layer list, and our viewer never sends it the layer request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:55:18 +03:00
selikhovandClaude Opus 5.5 7d91fd4b24 voelin-media: studio cameras on Windows through Media Foundation
On Windows the studio listed only the test pattern: there was no camera
backend.

`camera::mf` lists cameras with MFEnumDeviceSources (the symbolic link as
the id, the friendly name, every native format with its sizes and rates)
and captures one with an IMFSourceReader on a thread of its own: the
native format nearest the wanted size, the fastest up to the wanted rate,
handed out as NV12 at that size. With advanced video processing on, the
reader decodes MJPEG and converts the other formats itself, so every
camera reaches the compositor the same way, through the same pacer, pool
and background filter as on Linux. COM and Media Foundation are started
on those threads only, so the caller's apartment does not matter.

Never run: it is type-checked for x86_64-pc-windows-gnu (clippy with
-D warnings, also --all-targets), as nothing here runs Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:32:38 +03:00
selikhovandClaude Opus 5.5 ecb0e11668 Pick several audio sources at once, with the apps' own icons
The phone had no way to choose which apps a stream carries: the
studio's audio picker added one source and closed, and Android's app
list had names only. The picker now marks what is mixed in already
(stream.audio_sources) and switches a source on or off with a tap, so
several apps (and the microphone, desktop audio, test tones) are picked
in one go; Done closes it. Android's launchable apps come with their
icons: Kotlin draws each app's icon once per installed version into a
96 px PNG in the cache and hands over its path (AudioApp::icon), which
the picker shows. The shared window's audio is not offered on Android,
which shares the whole screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:30:04 +03:00
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 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 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 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