Merge the development branch: Wave 5B's phone screens and dialogs

Brings the phone screens and dialogs, the quick share's sound and the
voelinctl stream commands of every channel in before the add-server
dialog changes, so they are made on top of the current dialogs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 23:21:12 +03:00
commit 2cd03ddb8e
74 files changed
+4406 -355

No files matched your search

+97 -17
View File
@@ -2,23 +2,30 @@
The Android app is the desktop UI (`voelin-ui`, Slint) running in a
`NativeActivity`, plus a thin Kotlin layer for what only Java APIs can do:
foreground services, the screen-capture consent, the Keystore.
foreground services and their notifications, the screen-capture consent,
the cameras, the share sheet, the Keystore.
```
android/ Gradle project (AGP 8.13, Kotlin 2.3, Gradle 8.14.3 wrapper)
app/src/main/java/.../voelin/ MainActivity (NativeActivity), Bridge, Native,
VoiceService, ScreenCaptureService, SecretStore
app/src/main/java/.../voelin/ MainActivity (NativeActivity, Share to Voelin), Bridge,
Native, VoiceService, ScreenCaptureService, Notifications,
CameraCapture, SecretStore
crates/voelin-android/ libvoelin_android.so: android_main, engine host,
JNI glue, capture providers, Keystore secrets
JNI glue, capture and camera providers, notifications
(foreground.rs), Keystore secrets
```
The phone layout of the UI (the voice channel with a stream, the bottom
navigation, the studio, the share dialog) is described in
[ui.md](ui.md); its screenshots are taken on the desktop at 390×844.
## Building
Requirements:
- Android SDK with `platforms;android-36` and `build-tools;36.0.0`
(`ANDROID_HOME`, or `sdk.dir` in `android/local.properties`), NDK
`27.3.13750724` (`ndk;27.3.13750724`; the version is pinned in
`27.3.13750724` (`ndk;27.3.13750724`; the versions are pinned in
`app/build.gradle.kts`)
- JDK 17 or newer
- Rust targets: `rustup target add aarch64-linux-android x86_64-linux-android`
@@ -28,7 +35,7 @@ Requirements:
```sh
cd android
./gradlew assembleDebug # arm64-v8a + x86_64 (emulator)
./gradlew assembleDebug # arm64-v8a + x86_64 (emulator, Waydroid)
./gradlew assembleDebug -Pvoelin.abis=arm64-v8a # phones only, half the build
adb install -r app/build/outputs/apk/debug/app-debug.apk
adb logcat -s RustStdoutStderr ScreenCaptureService VoiceService SecretStore
@@ -79,19 +86,61 @@ capture, NDK MediaCodec format queries); targetSdk and compileSdk 36.
to the background instead of finishing the activity; configuration changes
do not recreate it.
- **Voice in the background**: while any session has a voice connection,
`VoiceService` runs as a foreground service of type `microphone` with a
notification ("In voice on …", Mute or Unmute, Disconnect). Rust drives it
from engine events (`foreground.rs`, `Bridge.setVoiceNotification`). Audio
itself is cpal on AAudio, as on desktop.
`VoiceService` runs as a foreground service of type `microphone`. Its
notification reads like the app's voice card: the channel as the title,
the server and who is 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; with several servers, "In voice on 2 servers" and their
names. Tapping it opens the voice channel screen (the activity hands the
request to Rust, which queues it until the window runs:
`voelin_ui::request`). Rust drives it from engine events (`foreground.rs`,
`Bridge.setVoiceNotification`). Audio itself is cpal on AAudio, as on
desktop.
- **Sharing the screen**: `voelin_media::capture::default_screen_capture()`
returns the MediaProjection provider (`capture.rs`) registered at start.
Starting shows the system consent dialog; on consent `ScreenCaptureService`
(type `mediaProjection`) mirrors the display into an `ImageReader` at the
requested frame rate, longest side at most 1920 px, and hands RGBA frames to
`Native.onScreenFrame`. System audio (`default_audio_capture()`) is
(type `mediaProjection`) mirrors the display, longest side at most
1920 px. While one MediaCodec encoder runs (one simulcast layer, one
codec: the common case) the virtual display renders straight into that
encoder's input surface, with no copy of a frame on the CPU; with more
encoders (layers, or a codec a viewer chose) it renders into an
`ImageReader` again, whose RGBA buffers go to the encoders borrowed
(`Native.onScreenFrame`), until one encoder is left ([media.md](media.md),
MediaCodec). System audio (`default_audio_capture()`) is
`AudioPlaybackCapture` of media, game and unknown usages, 48 kHz stereo
float, only while the projection runs. Ending the projection from the
status bar or the notification closes the capture channels.
float, only while the projection runs; single apps are captured by their
uid (`addMatchingUid`), "every app but ours" excludes ours. While our
stream is live the notification says where and who watches ("Live in
Chill Zone", "Home · 2 watching") with Stop sharing. Ending the
projection from the status bar or the notification closes the capture
channels.
- **Choosing the stream's sound**: the share dialog and the Stream Studio
pick the sources of `stream.audio_sources` in the studio's picker:
the microphone, every app but ours, and the launchable apps
(PackageManager) with their own icons, several at once. Kotlin draws each
app's icon once per installed version into a 96 px PNG in the cache
(`Bridge.launchableApps`, `AudioApp::icon`). The shared window's audio is not
offered: a phone shares the whole screen.
- **Cameras** (the Stream Studio's camera sources): `CameraCapture.kt`
lists the Camera2 cameras (front first, their YUV sizes and highest frame
rate) and asks for the `CAMERA` permission when a camera is first opened
(the source shows why if it is refused). It opens the camera into an
`ImageReader` (`YUV_420_888`) at the wished size or the nearest (16:9
first, 1280×720 by default) and hands each frame's planes to Rust as
direct buffers valid during the call, with the turn that makes it
upright. Rust (`camera.rs`) passes upright planar or NV12 pictures on as
they are and gathers NV21 or turned ones into I420 in a buffer each
camera keeps: nothing is allocated per frame. Cameras that face the user
are mirrored by default; the source menu's Switch camera moves a source
to the next camera ([studio.md](studio.md)).
- **Share to Voelin**: the activity 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).
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), then uploaded to the current chat's channel
(or the channel we are in) and linked there as the attach button does.
The copies live in the cache and are removed at the next start.
- **Watching and encoding**: `voelin_media::Codecs` uses the device's
MediaCodec encoders (hardware first) and decoders on Android
([media.md](media.md)).
@@ -107,7 +156,8 @@ capture, NDK MediaCodec format queries); targetSdk and compileSdk 36.
Permissions: `INTERNET`, `ACCESS_NETWORK_STATE`, `RECORD_AUDIO`,
`MODIFY_AUDIO_SETTINGS`, `FOREGROUND_SERVICE` with `_MICROPHONE` and
`_MEDIA_PROJECTION`, `POST_NOTIFICATIONS`.
`_MEDIA_PROJECTION`, `POST_NOTIFICATIONS`, `CAMERA` (asked for when a camera
is first opened; `android.hardware.camera.any` is optional).
## Status
@@ -115,8 +165,14 @@ Permissions: `INTERNET`, `ACCESS_NETWORK_STATE`, `RECORD_AUDIO`,
|---|---|---|
| `libvoelin_android.so` for `aarch64-linux-android` (Slint Android backend with Skia, AAudio, AWS-LC, SQLite, libopus) | `cargo ndk -t arm64-v8a build -p voelin-android` | builds; exports `android_main` and the `Native` methods |
| Debug APK | `./gradlew assembleDebug -Pvoelin.abis=arm64-v8a` | builds |
| Engine host replay, voice service policy | unit tests (`cargo test -p voelin-android`) | tested |
| Debug APK for phones and Waydroid (`arm64-v8a` + `x86_64`) | `./gradlew assembleDebug` on Linux: the Gradle 8.14.3 wrapper, Temurin JDK 17, an SDK with only `platforms;android-36`, `build-tools;36.0.0` and the NDK 27.3 | builds (Kotlin without warnings) |
| Engine host replay, voice service policy, the voice notification's text (deafen across sessions, several servers), the live stream's notice | unit tests (`cargo test -p voelin-android`) | tested |
| External capture providers, MediaCodec buffer layouts | `voelin-media` unit tests | tested |
| The phone screens: voice channel with a stream, Home, Servers, Chats, Activity, You, Settings, Stream Studio, the share dialog with its sound | headless screenshots at 390×844 ([ui.md](ui.md)) | tested on the desktop (the same Slint UI; not on a device) |
| A tapped voice notification opens the voice screen; text shared to the app lands in the composer | `VOELIN_OPEN=notification`, `VOELIN_OPEN=shared:<text>` on the desktop | the Rust side tested headless; the notifications, their actions, the share sheet and file uploads from it compile only |
| Cameras: YUV planes borrowed, gathered into I420, turned | `voelin-media` `camera::tests::camera_planes_are_borrowed_gathered_and_turned` | the Rust side tested; Camera2, the permission flow and switching compile only |
| The virtual display into the encoder's input surface, back to the reader for simulcast | `cargo ndk -t arm64-v8a clippy` | compiles only: frames per second and CPU use not measured (no device; Waydroid's encoders are software ones, if any) |
| The app picker with icons | the studio's and the share dialog's picker with sample data (headless) | the UI tested; the PackageManager list and its icons compile only |
| The app on a device: UI, voice in the background, screen sharing, watching, Keystore | manual matrix row IN3 and the Android rows | not run yet (no device or emulator in this environment) |
| Waydroid (Mesa GL) | the debug APK, `waydroid logcat` | works with the EGL workaround (below); before it, the app ended at start because Skia could not create its GL context |
@@ -128,6 +184,9 @@ Known gaps:
`Codecs` uses MediaCodec.
- Rotating the device while sharing letterboxes the picture (the virtual
display keeps its size).
- Cameras deliver while the app is in front: there is no foreground service
of type `camera`, so Android stops a camera source when the app goes to
the background (the screen share goes on).
- The safe area (status and navigation bars) and the on-screen keyboard pad
the main window; dialogs drawn over it do not account for them yet.
- Only `arm64-v8a` and `x86_64` are built; 32-bit devices are not supported.
@@ -154,3 +213,24 @@ I RustStdoutStderr: … Could not create Skia Direct Context from GL interface
at start, before Slint's surface, so they get slots first (logcat:
`EGL: N of 83 Skia extension functions resolved`). Vendor GPU drivers on
phones return nothing for desktop-only names and are not affected.
### Trying it on Waydroid
Waydroid on a PC runs the `x86_64` library, which the default
`assembleDebug` builds (`rustup target add x86_64-linux-android` first):
```sh
cd android && ./gradlew assembleDebug
waydroid app install app/build/outputs/apk/debug/app-debug.apk
waydroid app launch io.github.faumaray.Voelin
waydroid logcat | grep -E 'RustStdoutStderr|MainActivity|VoiceService|ScreenCaptureService|CameraCapture'
```
Things to try there: the bottom navigation (Home, Servers, Chats,
Activity, You), joining a voice channel and its screen from the top bar's
voice button, the voice notification (pull down the shade: Mute, Deafen,
Leave, tap it), Share from another app's share sheet (text, then a file),
the voice screen's Share (the screen share dialog) with sound from the
audio picker (app icons) and its gain and mute while live, and Go Live's
Stream Studio with a camera source (Waydroid usually has no camera: the
source then says why).
+40 -10
View File
@@ -21,8 +21,8 @@ described in [studio.md](studio.md).
| `AudioBuffer { samples, channels, timestamp }` | interleaved `f32`, 48 kHz |
| `convert::to_rgba(&frame, out, stride)`, `to_rgba_vec`, `to_i420`, `psnr` | BT.601 limited range (the WebRTC default). `to_rgba` writes straight into a Slint `SharedPixelBuffer<Rgba8Pixel>` (`make_mut_bytes()`, stride `width * 4`) |
| `Codec` | `Vp8`, `Vp9`, `H264`, `Av1`; `FromStr` for SDP/MIME names; `From`/`TryFrom` `str0m::format::Codec` with feature `str0m` |
| `VideoEncoder` | `encode(&frame, force_keyframe) -> Vec<EncodedFrame>`; `encode_with(&frame, force_keyframe, &mut |EncodedChunk| ..)` hands out the encoder's own buffer (no copy); `set_bitrate(bps)` (libvpx: in place, no keyframe), `set_fps`, `speed()`, `codec()`, `backend()`; `gpu_alignment()` / `encode_gpu(&GpuFrame, ..)` for encoders that take frames in GPU memory (VA-API) |
| `GpuFrame` | a picture in GPU memory (an NV12 VA-API surface), made by `ffmpeg::GpuConverter` from a captured DMA-BUF; `width`, `height`, `timestamp`, `at(timestamp)` (the same surface at another time) |
| `VideoEncoder` | `encode(&frame, force_keyframe) -> Vec<EncodedFrame>`; `encode_with(&frame, force_keyframe, &mut |EncodedChunk| ..)` hands out the encoder's own buffer (no copy); `set_bitrate(bps)` (libvpx: in place, no keyframe), `set_fps`, `speed()`, `codec()`, `backend()`; `gpu_alignment()` / `encode_gpu(&GpuFrame, ..)` for encoders that take frames in GPU memory (VA-API; MediaCodec's surface path on Android) |
| `GpuFrame` | a picture in GPU memory (an NV12 VA-API surface), made by `ffmpeg::GpuConverter` from a captured DMA-BUF; `width`, `height`, `timestamp`, `at(timestamp)` (the same surface at another time). On Android `rendered(width, height, timestamp)`: a screen picture the virtual display renders straight into MediaCodec's input surface, only its size and time travel |
| `EncodedFrame { data, keyframe, pts_90khz }` | one frame for `Peer::write` |
| `VideoDecoder` | `decode(&[u8]) -> Option<VideoFrame>` (timestamp zero; the caller knows the RTP time) |
| `EncoderConfig { fps, bitrate_bps, keyframe_interval, content, threads, speed }` | resolution follows the frames; a size change restarts with a keyframe; `threads` is a maximum (0: all CPUs but one), still capped at one per 320x240 pixels; `speed: None` adapts libvpx `cpu-used` to the encode time |
@@ -272,9 +272,13 @@ The audio of our stream is a mix of any number of sources
`[{"kind": "desktop"}, {"kind": "app", "name": "firefox", "gain": 0.5},
{"kind": "microphone", "muted": true}]`. Other kinds are `"window"` and
`"synthetic"` (`frequency`), and an app can be given by `"pid"`. The
default is desktop audio; `[]` shares without sound. The desktop app
reads it when sharing starts (`media::audio_source_specs`).
`media::audio_apps()` lists the applications for a picker.
default is desktop audio; `[]` shares without sound. The app's share
dialog and the Stream Studio pick and mix the sources with the same
mixer rows and picker ([ui.md](ui.md#sound-in-the-quick-share)); a share
hands them to its capture when it starts (`media::audio_source_specs`),
and a running share or studio follows every change of the key through
`Streamer::reconfigure`. `media::audio_apps()` lists the applications
for a picker.
What applications play is captured by `capture::playback::start_playback`:
@@ -584,9 +588,32 @@ takes and returns `VideoFrame`s like the software codecs. Encoders get NV12
`slice-height`, parsed by `codec::image_layout`, which is tested on every
platform); H.264 is High (preferably Constrained High) without B-frames, SPS/PPS
in front of every keyframe, keyframes on request (`request-sync`), bitrate
changes at runtime (`video-bitrate`). Encoder order: the device's hardware
encoders (H.264, VP9, VP8), then Google's software VP8 and H.264. Decoders
return the newest finished picture per `decode` call (NV12 or I420).
changes at runtime (`video-bitrate`). Encoders: the device's hardware ones
(H.264, VP9, VP8, AV1) and Google's software VP8 and H.264 (software VP9 and
AV1 are too slow), ordered by codec like every hardware encoder: the codecs
every TeamSpeak client decodes (AV1, VP9, VP8) before H.264. So a phone
without a hardware VP8, VP9 or AV1 encoder streams Google's software VP8 by
default; a stream codec set to H.264 uses its hardware H.264 encoder.
Decoders return the newest finished picture per `decode` call (NV12 or I420).
The zero-copy path for screen sharing: while it is the only MediaCodec
encoder in the process (one simulcast layer, one codec), an encoder reports a
`gpu_alignment`, and the capture's sink then takes `GpuFrame`s. The Android
provider's ticker hands it one per frame at the stream's rate; for the first
the encoder starts a codec with an input surface (`createInputSurface`,
`COLOR_FormatSurface`, `max-fps-to-encoder` at the stream's rate,
`repeat-previous-frame-after` 100 ms so a still screen still answers keyframe
requests) and publishes it (`mediacodec::input_surface`); the app points its
virtual display at that surface (`Bridge.setScreenSurface`, resized to the
layer's size), so the compositor renders the screen into the encoder: no
`ImageReader` frame, no RGBA to NV12 conversion, no copy. Each `GpuFrame`
then only collects what the codec encoded since; presentation times are the
display's (`CLOCK_MONOTONIC`), moved onto the capture's timeline. A second
encoder (another simulcast layer, another codec a viewer chose) turns the
path off for every encoder: the display goes back to the reader and frames
in memory, until it is the only one again. An encoder whose surface fails to
start stays on frames in memory. A frame-rate change restarts the surface
codec (the cap is fixed when it starts).
libvpx settings follow libwebrtc's realtime setup: one pass CBR, no lag,
`VPX_DL_REALTIME`, error resilient, keyframes only at start and on request
@@ -655,7 +682,7 @@ found at ...").
| Linux Wayland (`pipewire`, default) | `PortalCapture`: xdg-desktop-portal ScreenCast via `ashpd`, frames from a PipeWire video stream (LINEAR DMA-BUF or shared memory) | `PipeWireAudioCapture`: default sink monitor (`stream.capture.sink = true`) |
| Linux wlroots (`wlroots`, default) | `WlrootsCapture`: `ext-image-copy-capture-v1`, else `wlr-screencopy-unstable-v1`, outputs only, shared memory | |
| Windows | `WindowsCapture`: Windows Graphics Capture (`windows-capture`), monitors and windows | `WasapiLoopback`: process loopback excluding our own process tree, falling back to plain loopback |
| Android | `ExternalScreenCapture` fed by the app (MediaProjection → `ImageReader`, RGBA; see [android.md](android.md)) | `ExternalAudioCapture` fed by the app (`AudioPlaybackCapture` of every app but ours, 48 kHz float) |
| Android | `ExternalScreenCapture` fed by the app (MediaProjection → `ImageReader`, RGBA borrowed from the reader; or straight into the MediaCodec encoder's input surface, see [MediaCodec](#codecs); [android.md](android.md)) | `ExternalAudioCapture` fed by the app (`AudioPlaybackCapture` of every app but ours, 48 kHz float) |
`default_screen_capture()` picks a registered external provider first
(`capture::external::set_screen_provider`, which the Android app calls at
@@ -719,7 +746,8 @@ renders into one buffer, conversion and scaling write into recycled frames,
handoffs are atomic pointer swaps, and libvpx output is borrowed. The one
allocation per encoded frame is the `Arc<[u8]>` of `EncodedFrame`, whose size
varies per frame and so cannot be recycled. Backends outside our control add
their own (x11rb reply buffers; the Android provider hands owned frames).
their own (x11rb reply buffers; the Android provider's `start` path copies
frames into the queue, its `start_sink` path, the one streams use, does not).
```sh
# The real pipeline on the test pattern, no server:
@@ -1049,6 +1077,7 @@ has not run on Windows yet.
| Stream mixer (latency, fade on underrun, drift correction, rate conversion, limiter, levels, live source changes), `BlockClock` | `voelin-media` `mix::tests`, `tests/mix_alloc.rs` (no allocation per block) | tested |
| Application audio on PipeWire: desktop without our own stream, by name, by pid, a new player linked live, a quit one dropped, a restarted one matched again, the app list | `voelin-media/tests/pipewire_apps.rs` (private PipeWire, WirePlumber and D-Bus; tones told apart by frequency) | tested with PipeWire 1.0 and WirePlumber 0.4; skipped without them |
| Streamer audio sources (mix levels, gain, mute, live change, microphone tap, window source error, silence) | `voelin-core` `media::tests::audio_sources_change_live`, `audio_sources_from_settings`, `settings::tests::audio_sources` | tested |
| The share dialog's audio: the picked sources (gain, mute) in the capture request, none with "Share system audio" off; a running share following `stream.audio_sources` (a share without sound left so) | `voelin-ui` `streams::tests::the_share_carries_the_picked_audio`, `video::tests::a_share_follows_its_audio_sources`; headless screenshots (`share`, `share:live`) | tested; the dialog itself only in headless screenshots (nothing clicked) |
| X11 `_NET_WM_PID` of the shared window | `tests/x11_capture.rs` under Xvfb (`VOELIN_X11_TEST_DISPLAY`) | tested |
| WASAPI per-process loopback, audio sessions, `HWND` owner | – | type-checked for `x86_64-pc-windows-gnu` only |
| Android per-app and all-but-ours playback capture | `cargo ndk -t arm64-v8a clippy`, `gradlew compileDebugKotlin` | compiles only (no device or emulator here) |
@@ -1058,3 +1087,4 @@ has not run on Windows yet.
| External capture providers (start, refusal, end of capture, default selection) | unit tests | tested |
| MediaCodec buffer layouts (I420, NV12 with padding, `MediaImage2` NV21, crop) | unit tests (`codec::image_layout`) | tested |
| MediaCodec encoders and decoders | – | compiles for `aarch64-linux-android` only (no device or emulator here) |
| MediaCodec zero-copy screen path (virtual display into the encoder's input surface, back to the reader for simulcast) | `cargo ndk -t arm64-v8a clippy` | compiles only (no device or emulator here; fps and CPU not measured) |
Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 30 KiB

+12 -1
View File
@@ -133,6 +133,17 @@ other formats itself. Frames go through the same pacer, pool and
background filter as on Linux. **Never run**: it is type-checked for
`x86_64-pc-windows-gnu` only, as nothing here runs Windows.
Android: the app registers a `camera::CameraProvider` (Camera2 through its
Kotlin side, [android.md](android.md#cameras)), whose cameras `list()` puts
first (front ones first). A camera opens into an `ImageReader`
(YUV_420_888) and its planes arrive as `camera::YuvPlanes` with the turn
that makes the picture upright for the screen's rotation: an upright planar
or NV12 picture goes to the source's sink as it is, NV21 and turned ones are
gathered into I420 in a buffer each camera keeps (nothing is allocated per
frame). `Camera::mirrored` is the default mirroring (a camera that faces the
user; not a phone's back camera); the source menu's Switch camera moves a
camera source to the next camera.
## Background replacement (`studio::segment`)
A source's `background` is `keep`, `blur` (`strength`: radius as a fraction
@@ -356,7 +367,7 @@ two threads) takes about 3 ms at its own rate (15 fps by default).
| Background blur, image and colour backdrops on the oval mask | `segment::tests` | tested |
| Person segmentation (PP-HumanSeg through tract): loads, 192x192 mask, nobody in an empty room, time per mask | `segment::tests::the_model_finds_nobody_in_an_empty_room` | tested (about 50 ms per mask); on a photo of a person the mask follows the silhouette, arms and legs included (checked by eye, the photo is not in the repository); not yet tried with a camera |
| Windows cameras (Media Foundation: listing, the native format nearest the wanted size, NV12 through the source reader, MJPEG decoded by it) | `cargo clippy --target x86_64-pc-windows-gnu -p voelin-media` | type-checked only, never run |
| Android cameras | – | not implemented: `camera::list()` has only the test pattern there |
| Android cameras (Camera2): planes borrowed, gathered or turned | `camera::tests::camera_planes_are_borrowed_gathered_and_turned` (the Rust side) | tested on the host; the Camera2 side compiles only (no device here) |
| RTMP: the FLV tags (sizes, times past 24 bits, AVC from Annex B, `onMetaData` in AMF0), URL and key handling (the name hides the key), dead servers refused | `flv::tests`, `rtmp::tests` | tested |
| RTMP beside another stream codec: an output asks for H.264 of its layer only, its packets reach it alone, the recording and the replay buffer keep the stream's | `studio::tests::packets_reach_the_outputs_and_the_studio_is_a_capture_backend` | tested |
| RTMP: write errors seen (`AVIOContext.error`, found at load), an abort ends a stuck connect, the sample format field of the AAC encoder, Opus → AAC (frames back to back from the packets' clock, priming, a gap restarts the clock) | `ffmpeg::avio::tests`, `ffmpeg::audio::tests`, `ffmpeg::tests` | tested with FFmpeg 9.0.1 (libavformat 63: `error` at 84, `sample_fmt` at 348) and FFmpeg 4.4.8 (58: 120 and 408) |
+23 -4
View File
@@ -181,6 +181,25 @@ 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.
### Sound in the quick share
The share dialog (`share`, and `share:live` for a running share) mixes its
sound with the studio's pieces: while "Share system audio" is on (off: no
audio at all) it shows the studio's mixer rows (`MixerRow`: meter, gain,
mute, a menu) for `stream.audio_sources`, and Add opens the studio's picker
(`PickDialog`) over it: the microphone, desktop audio without Voelin, the
shared window's application, any application that plays (on Android the
launchable apps with their icons), several at once. The rows read the
main window's `StudioBridge`, filled without starting the studio
(`App::mixer_show`). Starting a share hands the sources to the capture
(`CaptureRequest::audio_sources`); while it runs the dialog shows the
same rows with the share mixer's meters (about 15 times a second), and
every change of `stream.audio_sources`, from the dialog or anywhere else,
goes to the running capture at once (`Capture::follow_audio`, which calls
`Streamer::reconfigure`). A share started without sound has no audio track
to add sources to. With sample data `share:live` shares the test pattern
with the sample studio's sources, live at once with sample viewers.
## Adding a screen
1. Write the screen in `ui/screens/<name>.slint` from the components
@@ -243,7 +262,7 @@ Environment variables (see `src/dev.rs`):
- `VOELIN_DEMO_UI=1`: sample servers, channels, members, chat with emoji and
a stream, without a server (nothing is stored).
- `VOELIN_OPEN=<what>[,<what>...]`: `home`, `server`, `settings[:voice|keybinds|streaming|privacy|appearance]`,
`about`, `share`, `bookmark`, `emoji`, `client`, `panel`, `no-panel`,
`about`, `share[:live]`, `bookmark`, `emoji`, `client`, `panel`, `no-panel`,
`voice`, `pins`, `topics`, `topic:<id>`, `member`, `watch`, `popout`
(the server page, above), `tab:<home|servers|chat|activity|you>` (phone
layout). With sample data, `watch` plays the local test pattern in the
@@ -296,13 +315,13 @@ the window's size so the pointer is not over the window, and passes
| ![home](screenshots/desktop-home.png) | ![light](screenshots/desktop-light.png) |
| ![settings](screenshots/desktop-settings-voice.png) | ![appearance](screenshots/desktop-settings-appearance.png) |
| ![emoji](screenshots/desktop-emoji-picker.png) | ![volume](screenshots/desktop-client-volume.png) |
| ![share](screenshots/desktop-share-dialog.png) | ![add server](screenshots/desktop-add-server.png) |
| ![about](screenshots/desktop-about.png) | |
| ![share](screenshots/desktop-share-dialog.png) | ![sharing](screenshots/desktop-share-live.png) |
| ![add server](screenshots/desktop-add-server.png) | ![about](screenshots/desktop-about.png) |
| Phone layout | | | | |
|---|---|---|---|---|
| ![chat](screenshots/mobile-chat.png) | ![servers](screenshots/mobile-servers.png) | ![home](screenshots/mobile-home.png) | ![you](screenshots/mobile-you.png) | ![settings](screenshots/mobile-settings.png) |
| ![studio](screenshots/mobile-studio.png) | | | | |
| ![voice channel](screenshots/mobile-voice.png) | ![activity](screenshots/mobile-activity.png) | ![studio](screenshots/mobile-studio.png) | ![share](screenshots/mobile-share.png) | ![sharing](screenshots/mobile-share-live.png) |
## Limits