Streams: an automatic bitrate up to 60 Mbit/s, and presets to match

The bitrate was a fixed 8 Mbit/s by default whatever was shared, and the
share dialog offered at most 10 Mbit/s and 60 fps. Asked for: Voelin
streams that can target 60 Mbit/s at up to 8K and 320 fps, with an
automatic bitrate that scales with the stream's resolution and frame rate
and follows it live, beyond 60 Mbit/s only when typed.

- `media::auto_bitrate(width, height, fps)`: 0.12 bits per pixel and
  frame (7.5 Mbit/s at 1080p30, 15 at 1080p60, 27 at 1440p60) between
  300 kbit/s and 60 Mbit/s, reached at 4K60 and 1080p240.
- `stream.bitrate_kbps` 0 is automatic and now the default. A streamer
  layer with bitrate 0 works it out per picture from the size encoded and
  the layer's frame rate, so a new resolution or frame rate moves it at
  once, and tells its sink (`MediaSink::auto_bitrate`). The engine's
  `StreamSink` puts it into the live stream's layer, so connections start
  their bandwidth estimate at it and probe for it; without that the
  stream would have kept the bitrate announced at the start.
  `Streamer::bitrate_kbps()` is what to announce.
- The quick share offers 15-320 fps and Auto, 2.5 to 60 Mbit/s (typed
  values still have no maximum; the `ui` blob keeps indices of the old
  lists for older versions). The studio offers 4K and 8K and 30-240 fps,
  takes an empty bitrate as automatic and derives its first simulcast
  layer from the automatic bitrate.
- The studio now tells the engine its layers when it goes live and when
  they change (`SetStreamLayers`), and a quick share resets them: the
  session sends only layers it knows of, so a studio's simulcast layers
  never reached a viewer, and its layer kept the bitrate announced.
- `voelinctl stream start` and `stream bench` default to the automatic
  bitrate too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-04 03:37:08 +03:00
1 parent 297dc2fe5b
commit ccc974fe05
13 files changed
+375 -85

No files matched your search

+16
View File
@@ -126,6 +126,22 @@ viewer: Engine::subscribe_frames ─ VideoPipeline (thread) ─ VideoDecoder
`MediaSink::layer_bitrate(id)` when the sink knows it (capped by
`max_bitrate`), else its configured bitrate; libvpx changes it in place
without a keyframe.
- Automatic bitrate: `bitrate_kbps` 0 (the default of the setting
`stream.bitrate_kbps`) gives the single layer `auto_bitrate(width,
height, fps)`: 0.12 bits per pixel and frame of the size and rate it is
encoded at (7.5 Mbit/s at 1080p30, 15 at 1080p60, 27 at 1440p60), at
least 300 kbit/s and at most 60 Mbit/s (`AUTO_BITRATE_MAX`, reached at
3840x2160@60, 2560x1440@135, 1920x1080@240). It follows the stream live:
the encoder thread works it out from each picture's size and the layer's
frame rate, so a resolution or frame-rate change moves it at once. The
sink is told with the first frame and whenever it changes
(`MediaSink::auto_bitrate`); the engine's `StreamSink` puts it into the
live stream's layer, so new connections start their bandwidth estimate at
it and all of them probe for it. `Streamer::bitrate_kbps()` is what to
announce in `setupstream` (the share dialog and the studio do, up to the
65535 kbit/s a server keeps: [protocol notes](protocol-notes/ts6-streaming.md#what-setupstream-takes-confirmed-600-beta131-2026-10-04)).
A typed bitrate is used as it is, above 60 Mbit/s too; nothing in Voelin
caps it (encoders take up to 2^32-1 bit/s).
- `Streamer::reconfigure(&codecs, StreamerConfigUpdate { fps, bitrate_kbps,
codec, encoder, layers, audio_sources })` applies from the next frame without restarting the
capture: encoders are created first (an error changes nothing), layers
+12 -1
View File
@@ -166,7 +166,7 @@ work before going live.
| Preview | `studio`, `studio:live`, `studio:record` | The composite, LIVE and the time (or PREVIEW, REC), watching and joined viewers, title • destination | `Studio::preview` turned into pictures on a thread of its own, latest wins; `State` |
| Audio mixer | `studio`, `studio:audio` | One row per `stream.audio_sources` entry: meter, gain (dB), mute, a menu; + adds the microphone, desktop audio without Voelin, the shared window's application or an application that plays | the mixer's meters (lock-free, about 15 times a second); `Streamer::reconfigure` follows the setting |
| Stream chat | `studio` | The chat of the channel the stream goes to and a composer | the destination tab's stored messages, made into lines as the chat view does |
| Stream settings | `studio` | Destination (the voice channel of each TeamSpeak 6 server we are in), title, game, go-live message (sent to the channel when the stream is up), Show Viewer Count / Chat Overlay / Now Playing, Enable Stream Audio, Advanced Settings, output size and rate (presets or any numbers), bitrate or simulcast layers | `studio.ui`, `stream.bitrate_kbps`, `stream.layers`, `SetOutput` |
| Stream settings | `studio` | Destination (the voice channel of each TeamSpeak 6 server we are in), title, game, go-live message (sent to the channel when the stream is up), Show Viewer Count / Chat Overlay / Now Playing, Enable Stream Audio, Advanced Settings, output size and rate (presets 720p to 8K and 30 to 240 fps, or any numbers), bitrate (empty: automatic, up to 60 Mbit/s) or simulcast layers | `studio.ui`, `stream.bitrate_kbps`, `stream.layers`, `SetOutput` |
| Bottom bar | `studio`, `studio:settings` | Share Window, Share Screen, Record Clip (and start or stop a recording, the replay length, the folder), Go Live, End Stream, Studio Settings (replay seconds and memory, folder, preview size) | `SaveClip`, `StartRecording`, `StopRecording`, `studio.*`, `SetPreview`; `Command::StartStream`, `Streamer::attach`, `GoLive`, `EndStream` |
| Window of its own | `studio:window` | The same pieces, compact | — |
@@ -181,6 +181,17 @@ game"), which is also what the gateway's directory shows. With sample data
the synthetic camera with background blur, text, colours) and test tones,
on settings in memory, and recordings go to a temporary folder.
### Frame rate and quality in the quick share
The share dialog's lists (`FPS_CHOICES`, `BITRATE_CHOICES` in
`src/settings.rs`, the same lists in `dialogs.slint`) offer 15, 30, 60,
120, 144, 240 and 320 fps, and Auto (the default: from the size and frame
rate shared, up to 60 Mbit/s, the bitrate field left empty), 2.5, 4.6, 8,
10, 20, 40 and 60 Mbit/s; any other number can be typed, with no maximum.
Both are the settings `stream.fps` and `stream.bitrate_kbps` (0:
automatic). The `ui` blob keeps the index of the closest entry of the old
three- and four-entry lists for older versions.
### Sound in the quick share
The share dialog (`share`, and `share:live` for a running share) mixes its