Merge the development branch: share menu, portal rows, every channel's streams

Both sides kept. From the development branch: the share dialog's portal
rows ("Same as last time" restores the portal's last choice), the Share
button's menu with the Stream Studio in it instead of a button of its
own in the desktop top bar and the phone header, the codec order,
person segmentation for the studio, and streams of every channel.

The phone header keeps this wave's search button next to the bell; the
studio button goes as on the development branch. video.rs keeps the
development branch's imports without EncoderReport, which the
Integrations page now asks the codecs for itself. The Devices page
lists the capture sources without the restore row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 22:16:48 +03:00
commit 4bff98ca27
43 files changed
+24589 -287

No files matched your search

+1
View File
@@ -0,0 +1 @@
*.onnx binary
Generated
+378 -4
View File
@@ -396,6 +396,12 @@ version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"
[[package]]
name = "anymap3"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5dfbc6d8d2675589ccbe4d0fd61df2419075625f8c1a62325e718e2b0049f9"
[[package]]
name = "apple-native-keyring-store"
version = "1.0.2"
@@ -910,6 +916,15 @@ dependencies = [
"bit-vec 0.9.1",
]
[[package]]
name = "bit-set"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56d87354e4229f54a44f7bf2435906a4656dba36026ab6eaca629a2c436a691c"
dependencies = [
"bit-vec 0.10.1",
]
[[package]]
name = "bit-vec"
version = "0.6.3"
@@ -925,6 +940,16 @@ dependencies = [
"serde",
]
[[package]]
name = "bit-vec"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5727b15fa97d4f4fee0a3b7c3d550ed0269f54329207b86388de918604e31269"
dependencies = [
"borsh",
"serde",
]
[[package]]
name = "bitflags"
version = "1.3.2"
@@ -1024,10 +1049,24 @@ version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "553c5d846a6ba5150c65e3b1b8ec073bcf1abc20f9b7220de384a4443ea4e20a"
dependencies = [
"borsh-derive",
"bytes",
"cfg_aliases",
]
[[package]]
name = "borsh-derive"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12cdfe656708a01f89b451a7d36466e6fe6c414de0aa18fc54f864f6f9ca9f56"
dependencies = [
"once_cell",
"proc-macro-crate",
"proc-macro2",
"quote",
"syn 3.0.6",
]
[[package]]
name = "bumpalo"
version = "3.20.3"
@@ -2008,6 +2047,17 @@ dependencies = [
"serde_core",
]
[[package]]
name = "derive-new"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cdc8d50f426189eef89dac62fabfa0abb27d5cc008f25bf4156a0203325becc"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.119",
]
[[package]]
name = "derive_more"
version = "2.1.1"
@@ -2159,6 +2209,12 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
[[package]]
name = "downcast-rs"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "117240f60069e65410b3ae1bb213295bd828f707b5bec6596a1afc8793ce0cbc"
[[package]]
name = "dpi"
version = "0.1.2"
@@ -2217,6 +2273,18 @@ version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
[[package]]
name = "dyn-clone"
version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
[[package]]
name = "dyn-hash"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fdab65db9274e0168143841eb8f864a0a21f8b1b8d2ba6812bbe6024346e99e"
[[package]]
name = "eax"
version = "0.5.0"
@@ -2413,6 +2481,17 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
[[package]]
name = "erased-serde"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2add8a07dd6a8d93ff627029c51de145e12686fbc36ecb298ac22e74cf02dec"
dependencies = [
"serde",
"serde_core",
"typeid",
]
[[package]]
name = "errno"
version = "0.3.14"
@@ -2603,6 +2682,12 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"
[[package]]
name = "float-ord"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ce81f49ae8a0482e4c55ea62ebbd7e5a686af544c00b9d090bba3ff9be97b3d"
[[package]]
name = "fnv"
version = "1.0.7"
@@ -4055,6 +4140,15 @@ version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36eee07d8e02bd95bf52b2e642cf13d33701b94c6e4b04fbf1d1fb07e9cb19e7"
[[package]]
name = "inventory"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4f0c30c76f2f4ccee3fe55a2435f691ca00c0e4bd87abe4f4a851b1d4dac39b"
dependencies = [
"rustversion",
]
[[package]]
name = "io-lifetimes"
version = "1.0.11"
@@ -4576,6 +4670,12 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dae608c151f68243f2b000364e1f7b186d9c29845f7d2d85bd31b9ad77ad552b"
[[package]]
name = "maplit"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
[[package]]
name = "matchers"
version = "0.2.0"
@@ -4591,6 +4691,16 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
[[package]]
name = "matrixmultiply"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f607c237553f086e7043417a51df26b2eb899d3caff94e6a67592ff992fedc7"
dependencies = [
"autocfg",
"rawpointer",
]
[[package]]
name = "md5"
version = "0.8.1"
@@ -4612,6 +4722,12 @@ dependencies = [
"libc",
]
[[package]]
name = "memo-map"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5449c8c750f1a07ea702bbd212bd999fceece9b3d1508b17023b3e174583124b"
[[package]]
name = "memoffset"
version = "0.9.1"
@@ -4627,6 +4743,16 @@ version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "minijinja"
version = "2.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86886cf6dbf4e614b19c9a1eec9775f021869d7eadde0fc73921a81b90c9b4c9"
dependencies = [
"memo-map",
"serde",
]
[[package]]
name = "minimal-lexical"
version = "0.2.1"
@@ -4748,7 +4874,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a616d2fb8c89516ac2723a581f69d6c18576046bed761bd6b305e5618e6ae130"
dependencies = [
"arrayvec",
"bit-set",
"bit-set 0.10.0",
"bitflags 2.13.2",
"cfg-if",
"cfg_aliases",
@@ -4785,6 +4911,21 @@ version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308d96db8debc727c3fd9744aac51751243420e46edf401010908da7f8d5e57c"
[[package]]
name = "ndarray"
version = "0.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "520080814a7a6b4a6e9070823bb24b4531daac8c4627e08ba5de8c5ef2f2752d"
dependencies = [
"matrixmultiply",
"num-complex",
"num-integer",
"num-traits",
"portable-atomic",
"portable-atomic-util",
"rawpointer",
]
[[package]]
name = "ndk"
version = "0.8.0"
@@ -4869,6 +5010,15 @@ dependencies = [
"memchr",
]
[[package]]
name = "nom-language"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2de2bc5b451bfedaef92c90b8939a8fff5770bdcc1fafd6239d086aab8fa6b29"
dependencies = [
"nom 8.0.0",
]
[[package]]
name = "notify-rust"
version = "4.18.0"
@@ -6157,6 +6307,29 @@ version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5"
[[package]]
name = "prost"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "528ac67416ff8646872a3c02cad9cc4ee5dc9f9540c9b10771855c95cb2e5ae1"
dependencies = [
"bytes",
"prost-derive",
]
[[package]]
name = "prost-derive"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b570b25f7617e43d59005d0990ccb79e950a423952cea19671b7a876da390adf"
dependencies = [
"anyhow",
"itertools 0.14.0",
"proc-macro2",
"quote",
"syn 2.0.119",
]
[[package]]
name = "pulldown-cmark"
version = "0.13.4"
@@ -6376,6 +6549,16 @@ version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
[[package]]
name = "rand_distr"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d431c2703ccf129de4d45253c03f49ebb22b97d6ad79ee3ecfc7e3f4862c1d8"
dependencies = [
"num-traits",
"rand 0.10.3",
]
[[package]]
name = "rand_pcg"
version = "0.10.2"
@@ -6409,6 +6592,12 @@ dependencies = [
"objc2-quartz-core 0.3.2",
]
[[package]]
name = "rawpointer"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
[[package]]
name = "rayon"
version = "1.12.0"
@@ -7960,6 +8149,16 @@ dependencies = [
"float-cmp",
]
[[package]]
name = "string-interner"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad3df9b59e2eded8d825c7c4363ad339a20fb6bc0b9a4778560f518f59910b15"
dependencies = [
"hashbrown 0.16.1",
"serde",
]
[[package]]
name = "strsim"
version = "0.11.1"
@@ -8617,6 +8816,174 @@ dependencies = [
"tracing-log",
]
[[package]]
name = "tract-core"
version = "0.23.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a5a9e07e863fc28355436c5a48fe859784832094ba1ff410357396ae87ff1e3"
dependencies = [
"anyhow",
"anymap3",
"bit-set 0.11.1",
"derive-new",
"downcast-rs 2.0.2",
"dyn-clone",
"erased-serde",
"inventory",
"lazy_static",
"log",
"maplit",
"ndarray",
"num-complex",
"num-integer",
"num-traits",
"pastey",
"rustfft",
"serde",
"smallvec",
"tract-data",
"tract-linalg",
]
[[package]]
name = "tract-data"
version = "0.23.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a33bafcf1d3dfa404c3271dd08304b162deb8fcfe9536290fb97e578c32d5dd5"
dependencies = [
"anyhow",
"downcast-rs 2.0.2",
"dyn-clone",
"dyn-hash",
"half",
"inventory",
"itertools 0.15.0",
"lazy_static",
"libm",
"maplit",
"ndarray",
"nom 8.0.0",
"nom-language",
"num-integer",
"num-traits",
"parking_lot",
"smallvec",
"string-interner",
]
[[package]]
name = "tract-extra"
version = "0.23.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a05c86ece0c47880c7726e08dabb72d68e9cba0cd36d44bc0aa90e2291a05db"
dependencies = [
"tract-nnef",
]
[[package]]
name = "tract-hir"
version = "0.23.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a52e3ec1f3beb16d552806386e123cf5632d4206154695a80aaecdb6ee2c5128"
dependencies = [
"derive-new",
"log",
"tract-core",
]
[[package]]
name = "tract-linalg"
version = "0.23.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cc37ab328b95cef8eef98324122e9f956fd3ca197f0892e09ff90fe495fa222"
dependencies = [
"byteorder",
"cc",
"derive-new",
"downcast-rs 2.0.2",
"dyn-clone",
"dyn-hash",
"half",
"inventory",
"lazy_static",
"libc",
"log",
"minijinja",
"num-traits",
"pastey",
"tract-data",
"walkdir",
]
[[package]]
name = "tract-nnef"
version = "0.23.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d95e30d7e6c2f73516212367a5b49354c105b52285e8919ec439c84556f54b3"
dependencies = [
"byteorder",
"erased-serde",
"log",
"nom 8.0.0",
"nom-language",
"serde",
"serde_json",
"simd-adler32",
"tar",
"tract-core",
"walkdir",
]
[[package]]
name = "tract-onnx"
version = "0.23.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a316674683d04c6070146badf57a7b8b9d99d4e38f586cbe3214e553d70bc2d"
dependencies = [
"bytes",
"derive-new",
"log",
"memmap2",
"nom 8.0.0",
"nom-language",
"num-integer",
"num-rational",
"num-traits",
"prost",
"smallvec",
"tract-extra",
"tract-hir",
"tract-nnef",
"tract-onnx-opl",
"tract-transformers",
]
[[package]]
name = "tract-onnx-opl"
version = "0.23.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "091e126c52d608214f8784f468c7d0be44459e7a369fb9a26f92aa593a78f4a5"
dependencies = [
"getrandom 0.4.3",
"log",
"rand 0.10.3",
"rand_distr",
"rustfft",
"tract-extra",
"tract-nnef",
]
[[package]]
name = "tract-transformers"
version = "0.23.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eefbb8d21ab36b48185fc86a3e861b3b62e6dcfd97c3cc13b0dd34389b60916"
dependencies = [
"float-ord",
"rayon",
"tract-nnef",
]
[[package]]
name = "transpose"
version = "0.2.3"
@@ -8835,6 +9202,12 @@ dependencies = [
"serde",
]
[[package]]
name = "typeid"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c"
[[package]]
name = "typenum"
version = "1.20.1"
@@ -9195,6 +9568,7 @@ dependencies = [
"tokio",
"tracing",
"tracing-subscriber",
"tract-onnx",
"voelin-stream",
"wasapi",
"wayland-client",
@@ -9476,7 +9850,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078"
dependencies = [
"cc",
"downcast-rs",
"downcast-rs 1.2.1",
"rustix 1.1.5",
"scoped-tls",
"smallvec",
@@ -9660,7 +10034,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c018fce9b6270aa203c2fdd56f3cce996713534bd757e4ea58c8560b121f14"
dependencies = [
"arrayvec",
"bit-set",
"bit-set 0.10.0",
"bit-vec 0.9.1",
"bitflags 2.13.2",
"bytemuck",
@@ -9713,7 +10087,7 @@ dependencies = [
"android_system_properties",
"arrayvec",
"ash",
"bit-set",
"bit-set 0.10.0",
"bitflags 2.13.2",
"block2 0.6.2",
"bytemuck",
+10
View File
@@ -107,6 +107,16 @@ opt-level = 3
opt-level = 3
[profile.dev.package.x11rb-protocol]
opt-level = 3
# The studio's person segmentation (tract): unoptimized, one mask takes
# about half a second.
[profile.dev.package.tract-core]
opt-level = 3
[profile.dev.package.tract-linalg]
opt-level = 3
[profile.dev.package.tract-data]
opt-level = 3
[profile.dev.package.ndarray]
opt-level = 3
[profile.dev.package.wayland-backend]
opt-level = 3
[profile.dev.package.wayland-client]
+496 -12
View File
@@ -175,8 +175,8 @@ the crate's authors are listed as its copyright holders.
| License | Crates |
|---|---|
| MIT License | 619 |
| Apache License 2.0 | 29 |
| MIT License | 654 |
| Apache License 2.0 | 31 |
| Unicode License v3 | 26 |
| BSD 3-Clause "New" or "Revised" License | 22 |
| LicenseRef-Slint-Royalty-free-2.0 | 12 |
@@ -1019,7 +1019,7 @@ Used by: cpal 0.18.2, imgref 1.12.3, self_cell 1.3.0, unicode-linebreak 0.1.5
````
Used by: gethostname 1.1.0
Used by: gethostname 1.1.0, prost-derive 0.14.4, prost 0.14.4
````text
Apache License
@@ -2986,7 +2986,7 @@ DEALINGS IN THE SOFTWARE.
````
Used by: cfg-if 1.0.5, openssl-probe 0.2.1, scoped-tls 1.0.1, socket2 0.6.5
Used by: cfg-if 1.0.5, filetime 0.2.29, openssl-probe 0.2.1, scoped-tls 1.0.1, socket2 0.6.5
````text
Copyright (c) 2014 Alex Crichton
@@ -3477,7 +3477,7 @@ THE SOFTWARE.
````
Used by: either 1.18.0, itertools 0.14.0, itertools 0.15.0, petgraph 0.8.3
Used by: either 1.18.0, itertools 0.14.0, itertools 0.15.0, maplit 1.0.2, petgraph 0.8.3, rawpointer 0.2.1
````text
Copyright (c) 2015
@@ -3508,6 +3508,39 @@ DEALINGS IN THE SOFTWARE.
````
Used by: ndarray 0.17.2
````text
Copyright (c) 2015 - 2021 Ulrik Sverdrup "bluss",
Jim Turner,
and ndarray developers
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
````
Used by: wayland-backend 0.3.17, wayland-client 0.31.15, wayland-cursor 0.31.14, wayland-protocols-plasma 0.3.12, wayland-protocols-wlr 0.3.12, wayland-protocols 0.32.13, wayland-scanner 0.31.11, wayland-sys 0.31.11
````text
@@ -3533,7 +3566,7 @@ THE SOFTWARE.
````
Used by: tempfile 3.27.0
Used by: tempfile 3.27.0, xattr 1.6.1
````text
Copyright (c) 2015 Steven Allen
@@ -3671,6 +3704,31 @@ SOFTWARE.
````
Used by: float-ord 0.3.2
````text
Copyright (c) 2015 The rust-float-ord Developers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
````
Used by: jni-sys 0.3.1, jni-sys 0.4.1
````text
@@ -3934,6 +3992,39 @@ DEALINGS IN THE SOFTWARE.
````
Used by: matrixmultiply 0.3.11
````text
Copyright (c) 2016 - 2023 Ulrik Sverdrup "bluss"
Copyirhgt (c) 2018 R. Janis Goldschmidt
Copyright (c) 2021 DutchGhost [constparse.rs]
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
````
Used by: futures-channel 0.3.34, futures-core 0.3.34, futures-executor 0.3.34, futures-io 0.3.34, futures-macro 0.3.34, futures-sink 0.3.34, futures-task 0.3.34, futures-util 0.3.34, futures 0.3.34
````text
@@ -6440,7 +6531,7 @@ DEALINGS IN THE SOFTWARE.
````
Used by: downcast-rs 1.2.1
Used by: downcast-rs 1.2.1, downcast-rs 2.0.2
````text
Copyright (c) 2020 Ashish Myles and contributors
@@ -7585,6 +7676,37 @@ SOFTWARE.
````
Used by: bit-set 0.11.1, bit-vec 0.10.1
````text
Copyright (c) 2023 The Rust Project Developers
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
````
Used by: hyper-util 0.1.21
````text
@@ -8095,6 +8217,37 @@ DEALINGS IN THE SOFTWARE.
````
Used by: tar 0.4.46
````text
Copyright (c) The tar-rs Project Contributors
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
````
Used by: arrayvec 0.7.8
````text
@@ -8183,6 +8336,37 @@ DEALINGS IN THE SOFTWARE.
````
Used by: rand_distr 0.6.0
````text
Copyright 2018 Developers of the Rand project
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
````
Used by: rand 0.10.3, rand 0.8.8, rand 0.9.5, rand_chacha 0.3.1, rand_chacha 0.9.0, rand_core 0.6.4, rand_core 0.9.5
````text
@@ -8403,7 +8587,7 @@ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR I
````
Used by: zerocopy 0.8.58
Used by: zerocopy-derive 0.8.58, zerocopy 0.8.58
````text
Copyright 2023 The Fuchsia Authors
@@ -9148,6 +9332,33 @@ SOFTWARE.
````
Used by: string-interner 0.20.0
````text
MIT License
Copyright (c) 2020 by Robin Freyler
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
````
Used by: sys-locale 0.3.2
````text
@@ -9519,6 +9730,7 @@ Standard text, used by:
- accesskit_consumer 0.38.0: The AccessKit contributors (https://github.com/AccessKit/accesskit)
- accesskit_unix 0.22.1: The AccessKit contributors (https://github.com/AccessKit/accesskit)
- accesskit_windows 0.34.0: The AccessKit contributors (https://github.com/AccessKit/accesskit)
- anymap3 1.1.0: Olivier 'reivilibre' (fork maintainer) <contact@librepush.net>, Chris Morgan (original author) <rust@chrismorgan.info> (https://github.com/reivilibre/anymap3)
- aws-lc-sys 0.45.0: AWS-LC (https://github.com/aws/aws-lc-rs)
- cookie-factory 0.3.3: Geoffroy Couprie <geo.couprie@gmail.com>, Pierre Chifflier <chifflier@wzdftpd.net> (https://github.com/rust-bakery/cookie-factory)
- dasp_sample 0.11.0: mitchmindtree <mitchell.nordine@gmail.com> (https://github.com/rustaudio/sample.git)
@@ -9537,6 +9749,7 @@ Standard text, used by:
- ndk-context 0.1.1: The Rust Windowing contributors (https://github.com/rust-windowing/android-ndk-rs)
- ndk-sys 0.6.0+11769913: The Rust Windowing contributors (https://github.com/rust-mobile/ndk)
- ndk 0.9.0: The Rust Mobile contributors (https://github.com/rust-mobile/ndk)
- nom-language 0.1.0: contact@geoffroycouprie.com (https://github.com/rust-bakery/nom)
- quicklz 0.3.1: Flakebi <flakebi@t-online.de> (https://github.com/ReSpeak/quicklz)
- rcgen 0.14.10 (https://github.com/rustls/rcgen)
- realfft 3.5.0: HEnquist <henrik.enquist@gmail.com> (https://github.com/HEnquist/realfft)
@@ -9547,6 +9760,8 @@ Standard text, used by:
- str0m-proto 0.7.0: Martin Algesten <martin@algesten.se> (https://github.com/algesten/str0m)
- taffy 0.10.1: Alice Cecile <alice.i.cecile@gmail.com>, Johnathan Kelley <jkelleyrtp@gmail.com>, Nico Burns <nico@nicoburns.com> (https://github.com/DioxusLabs/taffy)
- tauri-winrt-notification 0.7.3: allenbenz, Tauri Programme within The Commons Conservancy (https://github.com/tauri-apps/winrt-notification)
- tract-extra 0.23.8: Mathieu Poumeyrol <kali@zoy.org> (https://github.com/sonos/tract)
- tract-transformers 0.23.8: Mathieu Poumeyrol <kali@zoy.org>, Louis Chouraki <louis.chouraki@sonos.com> (https://github.com/sonos/tract)
- windows-collections 0.2.0 (https://github.com/microsoft/windows-rs)
- windows-collections 0.3.2 (https://github.com/microsoft/windows-rs)
- windows-core 0.61.2: Microsoft (https://github.com/microsoft/windows-rs)
@@ -9809,7 +10024,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
````
Used by: android-activity 0.6.1, linebender_resource_handle 0.1.1, widestring 1.2.1
Used by: android-activity 0.6.1, half 2.7.1, linebender_resource_handle 0.1.1, widestring 1.2.1
````text
MIT License
@@ -9947,7 +10162,7 @@ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
````
Used by: adler2 2.0.1, anyhow 1.0.104, async-channel 2.5.0, async-executor 1.14.0, async-io 2.6.0, async-lock 3.4.2, async-process 2.5.0, async-signal 0.2.14, async-task 4.7.1, async-trait 0.1.92, atomic-waker 1.1.2, blocking 1.7.0, concurrent-queue 2.5.0, countme 3.0.1, curve25519-dalek-derive 0.1.1, displaydoc 0.2.7, endi 1.1.1, event-listener-strategy 0.5.4, event-listener 5.4.2, fastrand 2.5.0, futures-lite 2.6.1, group 0.13.0, group 0.14.0, itoa 1.0.18, linux-raw-sys 0.12.1, linux-raw-sys 0.4.15, num_enum 0.7.6, num_enum_derive 0.7.6, once_cell 1.21.4, ordered-stream 0.2.0, parking 2.2.1, pastey 0.2.3, pin-project-internal 1.1.13, pin-project-lite 0.2.17, pin-project 1.1.13, piper 0.2.5, polling 3.11.0, portable-atomic 1.15.0, proc-macro-crate 3.5.0, proc-macro2 1.0.107, quote 1.0.47, ref-cast-impl 1.0.27, ref-cast 1.0.27, rowan 0.17.0, rtrb 0.4.0, rustc-hash 1.1.0, rustix 0.38.44, rustix 1.1.5, rustversion 1.0.23, serde 1.0.229, serde_core 1.0.229, serde_derive 1.0.229, serde_json 1.0.151, serde_path_to_error 0.1.20, serde_repr 0.1.21, simd_cesu8 1.2.0, smol_str 0.2.2, smol_str 0.3.6, spin_on 0.1.1, syn 2.0.119, syn 3.0.6, thiserror-impl 1.0.69, thiserror-impl 2.0.21, thiserror 1.0.69, thiserror 2.0.21, unicode-ident 1.0.26, x11-dl 2.21.0, zbus-lockstep-macros 0.5.2, zbus-lockstep 0.5.2, zmij 1.0.23, zvariant_utils 4.2.0
Used by: adler2 2.0.1, anyhow 1.0.104, async-channel 2.5.0, async-executor 1.14.0, async-io 2.6.0, async-lock 3.4.2, async-process 2.5.0, async-signal 0.2.14, async-task 4.7.1, async-trait 0.1.92, atomic-waker 1.1.2, blocking 1.7.0, concurrent-queue 2.5.0, countme 3.0.1, curve25519-dalek-derive 0.1.1, displaydoc 0.2.7, dyn-clone 1.0.20, dyn-hash 1.0.0, endi 1.1.1, erased-serde 0.4.10, event-listener-strategy 0.5.4, event-listener 5.4.2, fastrand 2.5.0, futures-lite 2.6.1, group 0.13.0, group 0.14.0, inventory 0.3.24, itoa 1.0.18, linux-raw-sys 0.12.1, linux-raw-sys 0.4.15, num_enum 0.7.6, num_enum_derive 0.7.6, once_cell 1.21.4, ordered-stream 0.2.0, parking 2.2.1, pastey 0.2.3, pin-project-internal 1.1.13, pin-project-lite 0.2.17, pin-project 1.1.13, piper 0.2.5, polling 3.11.0, portable-atomic 1.15.0, proc-macro-crate 3.5.0, proc-macro2 1.0.107, quote 1.0.47, ref-cast-impl 1.0.27, ref-cast 1.0.27, rowan 0.17.0, rtrb 0.4.0, rustc-hash 1.1.0, rustix 0.38.44, rustix 1.1.5, rustversion 1.0.23, serde 1.0.229, serde_core 1.0.229, serde_derive 1.0.229, serde_json 1.0.151, serde_path_to_error 0.1.20, serde_repr 0.1.21, simd_cesu8 1.2.0, smol_str 0.2.2, smol_str 0.3.6, spin_on 0.1.1, syn 2.0.119, syn 3.0.6, thiserror-impl 1.0.69, thiserror-impl 2.0.21, thiserror 1.0.69, thiserror 2.0.21, tract-core 0.23.8, tract-data 0.23.8, tract-hir 0.23.8, tract-linalg 0.23.8, tract-nnef 0.23.8, tract-onnx-opl 0.23.8, tract-onnx 0.23.8, typeid 1.0.3, unicode-ident 1.0.26, x11-dl 2.21.0, zbus-lockstep-macros 0.5.2, zbus-lockstep 0.5.2, zmij 1.0.23, zvariant_utils 4.2.0
````text
Permission is hereby granted, free of charge, to any
@@ -10259,7 +10474,7 @@ THE SOFTWARE.
````
Used by: aho-corasick 1.1.5, byteorder-lite 0.1.0, byteorder 1.5.0, csv-core 0.1.13, csv 1.4.0, memchr 2.8.3
Used by: aho-corasick 1.1.5, byteorder-lite 0.1.0, byteorder 1.5.0, csv-core 0.1.13, csv 1.4.0, memchr 2.8.3, walkdir 2.5.0
````text
The MIT License (MIT)
@@ -10512,6 +10727,33 @@ SOFTWARE.
````
Used by: same-file 1.0.6, winapi-util 0.1.11
````text
The MIT License (MIT)
Copyright (c) 2017 Andrew Gallant
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
````
Used by: ff 0.13.1, ff 0.14.0
````text
@@ -10539,6 +10781,33 @@ THE SOFTWARE.
````
Used by: derive-new 0.7.0
````text
The MIT License (MIT)
Copyright (c) 2017-2021 nrc (Nick Cameron) and the derive-new contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
````
Used by: htmlparser 0.2.1, simplecss 0.2.2, unicode-vo 0.1.0
````text
@@ -11635,7 +11904,7 @@ bzip2/libbzip2 version 1.1.0 of 6 September 2010
````
## Bundled fonts, icons and emoji
## Bundled fonts, icons, emoji and models
<!-- From about-assets.md, appended by scripts/notices.sh. -->
@@ -11651,6 +11920,13 @@ The user interface bundles these assets (in crates/voelin-ui):
(https://creativecommons.org/licenses/by/4.0/). The SVG files are packed
into one archive; their content is unchanged.
The Stream Studio bundles this model (in crates/voelin-media/models):
- PP-HumanSeg (person segmentation for background replacement), as OpenCV
Zoo ships it (human_segmentation_pphumanseg_2023mar.onnx, ported from
PaddleHub), Copyright (c) 2021 PaddlePaddle Authors, under the Apache
License 2.0 (text below). Unchanged.
### OFL-1.1 (Inter)
````text
@@ -11795,3 +12071,211 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
````
### Apache-2.0 (PP-HumanSeg)
````text
Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
````
+216 -1
View File
@@ -1,5 +1,5 @@
## Bundled fonts, icons and emoji
## Bundled fonts, icons, emoji and models
<!-- From about-assets.md, appended by scripts/notices.sh. -->
@@ -15,6 +15,13 @@ The user interface bundles these assets (in crates/voelin-ui):
(https://creativecommons.org/licenses/by/4.0/). The SVG files are packed
into one archive; their content is unchanged.
The Stream Studio bundles this model (in crates/voelin-media/models):
- PP-HumanSeg (person segmentation for background replacement), as OpenCV
Zoo ships it (human_segmentation_pphumanseg_2023mar.onnx, ported from
PaddleHub), Copyright (c) 2021 PaddlePaddle Authors, under the Apache
License 2.0 (text below). Unchanged.
### OFL-1.1 (Inter)
````text
@@ -159,3 +166,211 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
````
### Apache-2.0 (PP-HumanSeg)
````text
Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
````
+2 -1
View File
@@ -53,7 +53,8 @@ tsproto-packets = { path = "../proto/tsproto-packets" }
tsproto-types = { path = "../proto/tsproto-types" }
[dev-dependencies]
tokio = { version = "1", features = ["macros", "net", "rt-multi-thread", "test-util"] }
# `process`: the browser interop test drives Chromium through Node.js.
tokio = { version = "1", features = ["macros", "net", "process", "rt-multi-thread", "test-util"] }
[lints]
workspace = true
+41 -16
View File
@@ -142,29 +142,37 @@ pub fn peer_config(codecs: &Codecs, mut config: PeerConfig) -> PeerConfig {
config
}
/// Whether every official TeamSpeak client decodes `codec`: their WebRTC
/// stack has VP8, VP9 and AV1 decoders built in. H.264 needs an OpenH264
/// library the official client downloads at start-up and may not get; it
/// still answers H.264 then, and decodes nothing (libwebrtc's
/// `NullVideoDecoder`). HEVC needs a hardware decoder.
pub fn decoded_everywhere(codec: Codec) -> bool {
matches!(codec, Codec::Vp8 | Codec::Vp9 | Codec::Av1)
}
/// What a streamer with `primary` as its stream codec offers, in order:
/// `primary`, the codecs of hardware encoders, VP8 through libvpx (every
/// TeamSpeak client decodes it), and HEVC last (for peers that take nothing
/// else). Other software encoders are only ever the stream codec, so no
/// viewer's answer starts one of them on top of it.
/// `primary`; the codecs of hardware encoders and VP8 through libvpx that
/// every TeamSpeak client decodes ([`decoded_everywhere`]), so that a
/// viewer, which answers with the first codec it supports, never picks
/// H.264 while one of them is there; H.264 from hardware; HEVC last (for
/// peers that take nothing else). Other software encoders are only ever the
/// stream codec, so no viewer's answer starts one of them on top of it.
pub fn offer_codecs(codecs: &Codecs, primary: Codec) -> Vec<Codec> {
let mut offer = vec![primary];
let mut hevc = false;
for (codec, backend) in codecs.encoders() {
let cheap = codecs.is_hardware(backend)
|| (codec == Codec::Vp8 && backend == voelin_media::EncoderBackend::Libvpx);
if !cheap || offer.contains(&codec) {
continue;
}
if codec == Codec::H265 {
hevc = true;
} else {
if cheap && !offer.contains(&codec) {
offer.push(codec);
}
}
if hevc && primary != Codec::H265 {
offer.push(Codec::H265);
}
// Stable: the encoder preference orders codecs of the same rank.
offer[1..].sort_by_key(|&codec| match codec {
_ if decoded_everywhere(codec) => 0,
Codec::H265 => 2,
_ => 1,
});
offer
}
@@ -180,12 +188,14 @@ pub fn encoder_preference(settings: &crate::settings::Settings) -> voelin_media:
/// The stream codec: `configured` if we can encode it, else the first codec
/// of the encoder preference (hardware first when enabled; VP8 through
/// libvpx without hardware), never HEVC (offered last only). Put it first in
/// `PeerConfig::video_codecs` before [`peer_config`].
/// libvpx without hardware) that every TeamSpeak client decodes
/// ([`decoded_everywhere`]), else any but HEVC (offered last only). Put it
/// first in `PeerConfig::video_codecs` before [`peer_config`].
pub fn preferred_codec(codecs: &Codecs, configured: Option<Codec>) -> Option<Codec> {
let encodable = codecs.encoder_codecs();
configured
.filter(|c| encodable.contains(c))
.or_else(|| encodable.iter().copied().find(|&c| decoded_everywhere(c)))
.or_else(|| encodable.into_iter().find(|c| *c != Codec::H265))
}
@@ -2827,6 +2837,21 @@ mod tests {
if all.encoder_codecs().contains(&Codec::H264) && !offer.contains(&Codec::H264) {
assert_eq!(offer_codecs(&all, Codec::H264)[..2], [Codec::H264, Codec::Vp8]);
}
// Whatever this machine has: codecs every TeamSpeak client decodes
// come before H.264, HEVC last, and the automatic stream codec is
// one of the first.
let rank = |c: &Codec| match c {
_ if decoded_everywhere(*c) => 0,
Codec::H265 => 2,
_ => 1,
};
let ranks: Vec<_> = offer[1..].iter().map(rank).collect();
assert!(ranks.is_sorted(), "{offer:?}");
assert!(preferred_codec(&all, None).is_some_and(decoded_everywhere), "{all:?}");
assert_eq!(
preferred_codec(&all, Some(Codec::H264)).is_some(),
all.encoder_codecs().contains(&Codec::H264)
);
}
/// A sink whose viewers chose `codecs`; keeps every video frame with its
+4 -2
View File
@@ -964,7 +964,8 @@ pub enum CodecChoice {
pub static STREAM_CODEC: Key<CodecChoice> = Key::new(
"stream.codec",
Kind::Choice(&["auto", "vp8", "vp9", "h264", "av1"]),
"Video codec of our stream.",
"Video codec of our stream. Official TeamSpeak clients always decode VP8, VP9 and AV1; \
H.264 only when they could download OpenH264.",
CodecChoice::default,
);
@@ -1047,7 +1048,8 @@ pub enum StreamPermissions {
/// Friends (contacts marked friend) are accepted; others are shown to
/// the user ([`crate::Event::StreamViewerRequest`]).
Friends,
/// Clients in our channel are accepted, others denied.
/// Clients in our channel are accepted; others (a stream can be watched
/// from any channel) are shown to the user.
#[default]
Channel,
/// Every join request is denied.
+15 -10
View File
@@ -4,13 +4,16 @@
//! The voice task forwards stream notifications here and sends the resulting
//! commands. Only started for TeamSpeak 6 servers.
//!
//! Streams that started before we joined are looked up on the server
//! (`requeststreaminfo`) and in the session's gateway directory: its
//! registered entries (stream id and streamer) are handed to the stream
//! sessions ([`voelin_stream::Streams::discovered`]) for streamers in our
//! channel, and a [`StreamLookup`] answers for the gateway when the server
//! cannot. Our own stream's life (live, viewers, ended) goes back to the
//! session ([`OwnStreamEvent`]), which keeps its directory entry.
//! The streams of the whole server are listed, in every channel: a stream can
//! be watched from any channel, as with the official client. Streams that
//! started before we joined, and streams in other channels (the server
//! announces a stream only in its channel), are looked up on the server
//! (`requeststreaminfo`), so no gateway is needed. A gateway's directory is a
//! second source: its registered entries (stream id and streamer) are handed
//! to the stream sessions ([`voelin_stream::Streams::discovered`]), and a
//! [`StreamLookup`] answers for the gateway when the server cannot. Our own
//! stream's life (live, viewers, ended) goes back to the session
//! ([`OwnStreamEvent`]), which keeps its directory entry.
use std::collections::{BTreeMap, BTreeSet};
use std::fmt;
@@ -554,10 +557,11 @@ impl StreamTask {
StreamPermissions::Nobody => Some(false),
// Friends are let in; others: ask.
StreamPermissions::Friends => self.friends.contains(&viewer.0).then_some(true),
// Our channel is let in; viewers from other channels: ask.
StreamPermissions::Channel => {
let discovery = self.streams.discovery();
let own = discovery.own_channel();
Some(own.is_some() && discovery.channel_of(viewer) == own)
(own.is_some() && discovery.channel_of(viewer) == own).then_some(true)
}
}
}
@@ -1016,7 +1020,8 @@ mod tests {
assert_eq!(parse_kind("game"), StreamKind::Screen);
}
/// `stream.permissions` answers join requests (`friends`: friends only, others are asked).
/// `stream.permissions` answers join requests (`friends` and `channel`:
/// those are let in, others are asked).
#[tokio::test(flavor = "multi_thread")]
async fn permissions_answer_join_requests() {
let in_channels = |streamer: u64, viewer: u64| {
@@ -1028,7 +1033,7 @@ mod tests {
for (permissions, viewer_channel, friend, expected) in [
(StreamPermissions::Everyone, 2, false, Some(true)),
(StreamPermissions::Channel, 1, false, Some(true)),
(StreamPermissions::Channel, 2, false, Some(false)),
(StreamPermissions::Channel, 2, false, None),
(StreamPermissions::Nobody, 1, false, Some(false)),
(StreamPermissions::Friends, 1, false, None),
(StreamPermissions::Friends, 2, true, Some(true)),
+187
View File
@@ -0,0 +1,187 @@
//! The stream's real encoders against a browser's WebRTC stack: the test
//! pattern, encoded by each encoder this machine has as a share encodes the
//! screen, sent by our streamer peer offering just that codec, must decode
//! at its size in headless Chromium (libwebrtc, the stack the official
//! TeamSpeak 6 client is built on).
//!
//! Runs only with `VOELIN_INTEROP=1` (see `tests/interop/README.md`). Codecs
//! the browser does not decode (H.264 in Playwright's Chromium, HEVC) are
//! skipped; `VOELIN_CHROMIUM=/usr/bin/chromium` tests a system Chromium that
//! decodes H.264.
#![cfg(feature = "media-desktop")]
use std::time::{Duration, Instant};
use serde_json::{Value, json};
use tokio::time::timeout;
use voelin_core::media::voelin_media::capture::SourceId;
use voelin_core::media::voelin_media::{Codec, Codecs};
use voelin_core::media::{
EncodedSource, EncoderPreference, Streamer, StreamerConfig, decoded_everywhere, media_codec,
peer_config, preferred_codec, video_codec,
};
use voelin_core::stream::{FrameSource, PeerConfig, VideoCodec};
use voelin_stream::{Peer, PeerEvent};
#[path = "../../../tests/interop/browser.rs"]
mod browser;
use browser::{Browser, enabled};
const SIZE: (u32, u32) = (1280, 720);
/// The test pattern encoded with `codec` by the encoders `preference` picks
/// (from DMA-BUFs with `dmabuf`, as the ScreenCast portal hands over the
/// screen).
async fn test_pattern(preference: EncoderPreference, codec: Codec, dmabuf: bool) -> EncodedSource {
let codecs = Codecs::new().with_preference(preference.clone());
let config = StreamerConfig {
source: SourceId::Synthetic,
synthetic_size: SIZE,
synthetic_dmabuf: dmabuf,
fps: 30,
bitrate_kbps: 3000,
audio: false,
codec,
encoder: preference,
..StreamerConfig::default()
};
EncodedSource::new(Streamer::start(&codecs, config).await.unwrap())
}
/// Our streamer peer with `config`'s offer, answered by the browser and
/// connected; the codec the answer chose, `None` if it took no video.
async fn connect(browser: &mut Browser, config: &PeerConfig) -> Option<(Peer, VideoCodec)> {
let (mut peer, offer) = Peer::offer(config, "interop").await.unwrap();
let answer = browser.call(json!({ "op": "answer", "sdp": offer })).await;
peer.accept_answer(answer["sdp"].as_str().unwrap()).await.ok()?;
let mut chosen = None;
timeout(Duration::from_secs(15), async {
loop {
match peer.next_event().await {
Some(PeerEvent::VideoCodec(codec)) => chosen = Some(codec),
Some(PeerEvent::Connected) => return,
Some(PeerEvent::Closed) | None => panic!("closed before connecting"),
_ => {}
}
}
})
.await
.expect("no connection with the browser");
Some((peer, chosen?))
}
/// Three seconds of `source` to `peer`; the browser's `inbound-rtp` video
/// stats.
async fn send(browser: &mut Browser, peer: &mut Peer, source: &mut EncodedSource) -> Value {
source.request_keyframe();
let mut frames = Vec::new();
let end = Instant::now() + Duration::from_secs(3);
while Instant::now() < end {
source.poll_frames(Instant::now(), &mut frames);
for f in frames.drain(..) {
peer.write(f.kind, f.time, f.data);
}
while let Some(event) = peer.try_next_event() {
if matches!(event, PeerEvent::KeyframeRequest) {
source.request_keyframe();
}
}
tokio::time::sleep(Duration::from_millis(5)).await;
}
let stats = browser.call(json!({ "op": "stats" })).await;
peer.close();
stats["inbound"]["video"].clone()
}
/// Whether the browser decoded most of three seconds at the stream's size.
fn decoded(video: &Value) -> Result<(), String> {
let frames = video["framesDecoded"].as_u64().unwrap_or(0);
let size = (video["frameWidth"].as_u64(), video["frameHeight"].as_u64());
let expected = (Some(u64::from(SIZE.0)), Some(u64::from(SIZE.1)));
if frames < 60 || size != expected {
return Err(format!("{frames} frames decoded at {size:?}"));
}
Ok(())
}
/// Every encoder of this machine (hardware ones from memory and from
/// DMA-BUFs) decodes in the browser: most frames decoded, at the stream's
/// size.
#[tokio::test(flavor = "multi_thread")]
async fn real_encoders_decode_in_browser() {
if !enabled() {
eprintln!("skipped: set VOELIN_INTEROP=1 (needs node, Playwright and Chromium)");
return;
}
let mut browser = Browser::start().await;
let codecs = Codecs::new();
let udmabuf = std::path::Path::new("/dev/udmabuf").exists();
let mut failed = Vec::new();
for (codec, backend) in codecs.encoders() {
let gpu = codecs.is_hardware(backend) && backend.name().ends_with("_vaapi") && udmabuf;
for dmabuf in [false, true].into_iter().filter(|d| !d || gpu) {
let what =
format!("{codec} {}{}", backend.name(), if dmabuf { " (DMA-BUF)" } else { "" });
let config = PeerConfig {
video_codecs: vec![video_codec(codec)],
audio: false,
// Headless Chromium lists only the H.264 profiles of
// libwebrtc's software decoder (Baseline, Constrained
// Baseline, Main), not the Constrained High we offer; its
// FFmpeg decoder takes our High profile streams all the same.
h264_profile_level_id: 0x42e01f,
..PeerConfig::loopback()
};
let Some((mut peer, _)) = connect(&mut browser, &config).await else {
eprintln!("{what}: the browser does not decode it, skipped");
continue;
};
let preference =
EncoderPreference { hardware: true, backend: backend.name().parse().unwrap() };
let mut source = test_pattern(preference, codec, dmabuf).await;
let video = send(&mut browser, &mut peer, &mut source).await;
eprintln!("{what}: {video}");
if let Err(e) = decoded(&video) {
failed.push(format!("{what}: {e}"));
}
}
}
browser.quit().await;
assert!(failed.is_empty(), "not decoded in the browser:\n{}", failed.join("\n"));
}
/// The offer a share makes on this machine (`preferred_codec`,
/// `peer_config`): the browser, which answers like the official client with
/// the first codec of the offer it lists, picks one every TeamSpeak client
/// decodes, never H.264 ahead of them (the official client may list H.264
/// without being able to decode it), and decodes it.
#[tokio::test(flavor = "multi_thread")]
async fn share_offer_picks_a_codec_every_client_decodes() {
if !enabled() {
eprintln!("skipped: set VOELIN_INTEROP=1 (needs node, Playwright and Chromium)");
return;
}
let mut browser = Browser::start().await;
let codecs = Codecs::new();
let primary = preferred_codec(&codecs, None).expect("an encoder");
let config = PeerConfig {
video_codecs: vec![video_codec(primary)],
audio: false,
..PeerConfig::loopback()
};
let config = peer_config(&codecs, config);
eprintln!("offer: {:?}", config.video_codecs);
let (mut peer, chosen) = connect(&mut browser, &config).await.expect("video answered");
let chosen = media_codec(chosen);
assert!(
decoded_everywhere(chosen),
"the browser chose {chosen} from {:?}",
config.video_codecs
);
let mut source = test_pattern(codecs.preference().clone(), chosen, false).await;
let video = send(&mut browser, &mut peer, &mut source).await;
eprintln!("{chosen}: {video}");
browser.quit().await;
decoded(&video).unwrap();
}
+6 -1
View File
@@ -9,7 +9,7 @@ repository.workspace = true
publish.workspace = true
[features]
default = ["vpx", "openh264", "openh264-download", "ffmpeg", "x11", "pipewire", "wlroots"]
default = ["vpx", "openh264", "openh264-download", "ffmpeg", "x11", "pipewire", "wlroots", "segment"]
# VP8 and VP9 through the system libvpx (pkg-config `vpx`).
vpx = ["dep:libvpx-native-sys"]
# H.264 through Cisco's prebuilt OpenH264 library, loaded at runtime. The
@@ -31,6 +31,10 @@ pipewire = ["dep:ashpd", "dep:pipewire", "dep:memmap2", "dep:rustix"]
# Screen capture on wlroots compositors (Sway, Hyprland, river, ...) without
# the portal: ext-image-copy-capture-v1 or wlr-screencopy-unstable-v1 (Linux).
wlroots = ["dep:wayland-client", "dep:wayland-protocols", "dep:wayland-protocols-wlr", "dep:memmap2", "dep:rustix"]
# The studio's background replacement finds the person with a segmentation
# model (PP-HumanSeg, ONNX, bundled in `models/`) run on the CPU by tract.
# Without it the background is cut around a centred oval.
segment = ["dep:tract-onnx"]
# Conversion between `Codec` and `str0m::format::Codec`.
str0m = ["dep:str0m"]
# The studio's WHIP output: a WebRTC session (str0m) set up over HTTP. Needs
@@ -54,6 +58,7 @@ image = { version = "0.25.10", default-features = false, features = ["jpeg", "pn
sha2 = { version = "0.10.9", optional = true }
str0m = { version = "0.23.1", default-features = false, optional = true }
thiserror = "2.0.21"
tract-onnx = { version = "0.23.8", optional = true }
tokio = { version = "1", features = ["sync"] }
tracing = "0.1.44"
yuv = "0.8.19"
@@ -0,0 +1,203 @@
Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+13
View File
@@ -0,0 +1,13 @@
# Models
`pphumanseg-2023mar.onnx`: PP-HumanSeg, PaddleSeg's portrait segmentation
model, as OpenCV Zoo ships it
(`models/human_segmentation_pphumanseg/human_segmentation_pphumanseg_2023mar.onnx`
in https://github.com/opencv/opencv_zoo, ported from PaddleHub). Copyright (c)
2021 PaddlePaddle Authors, under the Apache License 2.0
(`LICENSE-PP-HumanSeg`). Unchanged; SHA-256
`552d8a984054e59b5d773d24b9b12022b22046ceb2bbc4c9aaeaceb36a9ddf24`.
Input `x`: 1x3x192x192 RGB, `(value / 255 - 0.5) / 0.5`. Output: 1x2x192x192
probabilities, channel 1 the person. The studio's background replacement
(`src/studio/segment.rs`, feature `segment`) runs it with tract.
File diff suppressed because it is too large. Load diff
+3 -1
View File
@@ -9,7 +9,9 @@
//! disable it (see docs/media.md).
//!
//! TeamSpeak clients only decode H.264 Constrained High; OpenH264 encodes
//! without B-frames, so its High profile output qualifies.
//! without B-frames, so its High profile output qualifies. The official
//! client decodes H.264 only once it downloaded OpenH264 itself, so streams
//! prefer codecs it always decodes (`voelin_core::media::decoded_everywhere`).
use std::path::{Path, PathBuf};
+9 -7
View File
@@ -406,10 +406,12 @@ fn unavailable(codec: Codec, reason: impl Into<String>) -> Error {
Error::CodecUnavailable { codec, reason: reason.into() }
}
/// Order of codecs among hardware encoders: H.264 (every viewer decodes
/// it), AV1, VP9, VP8, and HEVC last (only for peers that take nothing
/// else).
const HARDWARE_ORDER: [Codec; 5] = [Codec::H264, Codec::Av1, Codec::Vp9, Codec::Vp8, Codec::H265];
/// Order of codecs among hardware encoders: the ones every TeamSpeak
/// client decodes first (AV1, VP9, VP8: the official client's WebRTC stack
/// has their decoders built in), then H.264 (the official client decodes it
/// only with an OpenH264 library it downloads at start-up and may not get),
/// and HEVC last (only for peers that take nothing else).
const HARDWARE_ORDER: [Codec; 5] = [Codec::Av1, Codec::Vp9, Codec::Vp8, Codec::H264, Codec::H265];
/// An encoder backend in the base order (before the preference applies).
struct Candidate {
@@ -868,8 +870,8 @@ mod tests {
codecs.encoders_for(&preference).iter().map(|(_, b)| b.name()).collect()
};
let auto = names(EncoderPreference::default());
// Hardware in codec order (HEVC last), then software.
assert_eq!(auto[..3], ["h264_gpu", "vp8_gpu", "hevc_gpu"]);
// Hardware in codec order (H.264 after VP8, HEVC last), then software.
assert_eq!(auto[..3], ["vp8_gpu", "h264_gpu", "hevc_gpu"]);
let position = |list: &[&str], name| list.iter().position(|n| *n == name).unwrap();
assert!(position(&auto, "x264") < position(&auto, "av1_sw"));
#[cfg(feature = "vpx")]
@@ -886,7 +888,7 @@ mod tests {
assert!(!named[1..].iter().any(|n| n.ends_with("_gpu")));
// The codecs follow the preference.
codecs.set_preference(EncoderPreference::default());
assert_eq!(codecs.encoder_codecs()[..3], [Codec::H264, Codec::Vp8, Codec::H265]);
assert_eq!(codecs.encoder_codecs()[..3], [Codec::Vp8, Codec::H264, Codec::H265]);
// The report ranks what the preference uses.
let report = codecs.report();
let openh264 = report.encoders.iter().find(|e| e.name == "openh264").unwrap();
+2
View File
@@ -76,6 +76,8 @@ pub enum Error {
Cancelled,
#[error("download failed: {0}")]
Download(String),
#[error("segmentation: {0}")]
Segmentation(String),
#[error("I/O: {0}")]
Io(#[from] std::io::Error),
}
+175 -15
View File
@@ -20,13 +20,12 @@
//! a placeholder — it exercises the mask path and the tests, and gives a
//! usable "blur everything but the middle" — but it does not find a person.
//!
//! A real segmenter is a small neural network (the MediaPipe-style selfie
//! segmentation models are what this is sized for: one 256x144 or 256x256
//! input, one mask output). That is not in this build: nothing here loads an
//! ONNX model yet, so [`Background::Blur`](crate::studio::scene::Background)
//! blurs around an oval rather than around a person. The seam is
//! [`Segmenter`]; a model-backed implementation drops in behind it without
//! touching the frame path.
//! [`HumanSeg`] (feature `segment`, on by default) finds the person:
//! PP-HumanSeg, PaddleSeg's portrait segmentation network (bundled in
//! `models/`, Apache-2.0), run on the CPU by tract. It is the default
//! segmenter when built in; if its model cannot be loaded, [`Ellipse`] stands
//! in. Other models drop in behind [`Segmenter`] without touching the frame
//! path.
use std::sync::atomic::{AtomicU32, AtomicU64, Ordering};
use std::sync::{Arc, Mutex, PoisonError};
@@ -96,6 +95,137 @@ pub trait Segmenter: Send {
fn mask(&mut self, frame: &VideoFrame, mask: &mut Mask) -> Result<()>;
}
/// PP-HumanSeg, PaddleSeg's portrait segmentation model, as OpenCV Zoo ships
/// it (`models/pphumanseg-2023mar.onnx`, Apache-2.0, see `models/README.md`),
/// run on the CPU by tract: the frame squeezed to 192x192 RGB in, the
/// probability of a person per pixel out, as a 192x192 mask the frame path
/// stretches back over the frame. The model is loaded once per process, on
/// the segmentation thread the first time it runs; if that fails,
/// [`Ellipse`] stands in.
#[cfg(feature = "segment")]
pub struct HumanSeg {
plan: Option<std::sync::Arc<tract_onnx::prelude::TypedSimplePlan>>,
/// The input tensor, filled in place for each mask.
input: tract_onnx::prelude::Tensor,
fallback: Option<Ellipse>,
}
#[cfg(feature = "segment")]
mod model {
use std::sync::{Arc, OnceLock};
use tract_onnx::prelude::*;
/// Width and height of the model's input and output.
pub const SIZE: usize = 192;
static ONNX: &[u8] = include_bytes!("../../models/pphumanseg-2023mar.onnx");
/// The optimised model, made once.
pub fn plan() -> Result<Arc<TypedSimplePlan>, String> {
static PLAN: OnceLock<Result<Arc<TypedSimplePlan>, String>> = OnceLock::new();
PLAN.get_or_init(|| {
tract_onnx::onnx()
.model_for_read(&mut &ONNX[..])
.and_then(|m| m.with_input_fact(0, f32::fact([1, 3, SIZE, SIZE]).into()))
.and_then(|m| m.into_optimized())
.and_then(|m| m.into_runnable())
.map_err(|e| format!("{e:#}"))
})
.clone()
}
}
#[cfg(feature = "segment")]
impl HumanSeg {
pub fn new() -> Self {
let size = model::SIZE;
Self {
plan: None,
input: tract_onnx::prelude::Tensor::zero::<f32>(&[1, 3, size, size])
.expect("a small tensor"),
fallback: None,
}
}
/// Fill the input from `frame` (packed RGBA): nearest sample per input
/// pixel, planar RGB, `value / 127.5 - 1`.
fn fill_input(&mut self, frame: &VideoFrame) -> Result<()> {
let FrameData::Rgba(plane) = &frame.data else {
return Err(Error::InvalidFrame("segmentation needs RGBA frames".into()));
};
let size = model::SIZE;
let (width, height) = (frame.width.max(1) as usize, frame.height.max(1) as usize);
let mut input =
self.input.try_as_plain_ram_mut().map_err(|e| Error::Segmentation(e.to_string()))?;
let input = input.as_slice_mut::<f32>().map_err(|e| Error::Segmentation(e.to_string()))?;
let (red, rest) = input.split_at_mut(size * size);
let (green, blue) = rest.split_at_mut(size * size);
for y in 0..size {
let row = plane.row(y * height / size, width * 4);
for x in 0..size {
let px = &row[x * width / size * 4..][..3];
let i = y * size + x;
red[i] = f32::from(px[0]) / 127.5 - 1.0;
green[i] = f32::from(px[1]) / 127.5 - 1.0;
blue[i] = f32::from(px[2]) / 127.5 - 1.0;
}
}
Ok(())
}
}
#[cfg(feature = "segment")]
impl Default for HumanSeg {
fn default() -> Self {
Self::new()
}
}
#[cfg(feature = "segment")]
impl Segmenter for HumanSeg {
fn name(&self) -> &'static str {
"pp-humanseg"
}
fn mask(&mut self, frame: &VideoFrame, mask: &mut Mask) -> Result<()> {
use tract_onnx::prelude::{IntoTValue, tvec};
if let Some(fallback) = &mut self.fallback {
return fallback.mask(frame, mask);
}
if self.plan.is_none() {
match model::plan() {
Ok(plan) => self.plan = Some(plan),
Err(e) => {
warn!("the segmentation model does not load, using an oval: {e}");
return self.fallback.insert(Ellipse::person()).mask(frame, mask);
}
}
}
self.fill_input(frame)?;
let plan = self.plan.as_ref().expect("loaded above");
// ponytail: tract takes the input by value; a 442 KiB copy per mask
// (a few a second) next to its own intermediates.
let outputs = plan
.run(tvec![self.input.clone().into_tvalue()])
.map_err(|e| Error::Segmentation(format!("{e:#}")))?;
let output =
outputs[0].try_as_plain_ram().map_err(|e| Error::Segmentation(e.to_string()))?;
let person = output.as_slice::<f32>().map_err(|e| Error::Segmentation(e.to_string()))?;
let size = model::SIZE;
// Channel 1 of the 1x2xHxW probabilities is the person.
let person = person
.get(size * size..2 * size * size)
.ok_or_else(|| Error::Segmentation(format!("an output of {} values", person.len())))?;
mask.resize(size as u32, size as u32);
for (m, p) in mask.data.iter_mut().zip(person) {
*m = (p.clamp(0.0, 1.0) * 255.0 + 0.5) as u8;
}
Ok(())
}
}
/// The segmenter that is always available: a centred oval covering most of
/// the frame. See the [module docs](self) for what it is and is not.
#[derive(Clone, Copy, Debug, Default)]
@@ -340,8 +470,12 @@ impl BackgroundFilter {
}
}
/// A filter with the built-in [`Ellipse`] segmenter.
/// A filter with the default segmenter: [`HumanSeg`] when built in, else
/// [`Ellipse`].
pub fn with_default_segmenter(mode: Background) -> Self {
#[cfg(feature = "segment")]
return Self::new(mode, Box::new(HumanSeg::new()));
#[cfg(not(feature = "segment"))]
Self::new(mode, Box::new(Ellipse::person()))
}
@@ -598,6 +732,36 @@ fn flat_rgba(width: u32, height: u32, rgba: [u8; 4]) -> VideoFrame {
mod tests {
use super::*;
/// A filter with the oval: these tests check the frame path, which
/// needs a mask that is known in advance.
fn oval_filter(mode: Background) -> BackgroundFilter {
BackgroundFilter::new(mode, Box::new(Ellipse::person()))
}
/// The bundled model loads and runs: a 192x192 mask of probabilities,
/// next to nothing in an empty, evenly lit room, and fast enough for a
/// few masks a second on one core.
#[cfg(feature = "segment")]
#[test]
fn the_model_finds_nobody_in_an_empty_room() {
let mut segmenter = HumanSeg::new();
let frame = flat_rgba(256, 144, [128, 120, 110, 255]);
let mut mask = Mask::default();
segmenter.mask(&frame, &mut mask).unwrap();
assert!(segmenter.fallback.is_none(), "the model did not load");
assert_eq!((mask.width, mask.height), (192, 192));
let mean = mask.data.iter().map(|&v| u64::from(v)).sum::<u64>() / mask.data.len() as u64;
assert!(mean < 64, "a person in an empty room: mean {mean}");
let start = Instant::now();
for _ in 0..5 {
segmenter.mask(&frame, &mut mask).unwrap();
}
let each = start.elapsed() / 5;
eprintln!("one mask in {each:?}");
// Debug builds run tract unoptimised; release is several times faster.
assert!(each < Duration::from_secs(2), "{each:?} per mask");
}
fn pixel(frame: &VideoFrame, x: u32, y: u32) -> [u8; 4] {
let FrameData::Rgba(p) = &frame.data else { panic!("not RGBA") };
p.row(y as usize, frame.width as usize * 4)[x as usize * 4..][..4].try_into().unwrap()
@@ -657,9 +821,7 @@ mod tests {
#[test]
fn a_colour_background_replaces_everything_but_the_subject() {
let mut filter = BackgroundFilter::with_default_segmenter(Background::Colour {
colour: Colour::rgb(200, 0, 0),
});
let mut filter = oval_filter(Background::Colour { colour: Colour::rgb(200, 0, 0) });
assert_eq!(filter.segmenter(), "ellipse");
let mut frame = flat_rgba(64, 64, [0, 255, 0, 255]);
// Wait for the first mask.
@@ -699,8 +861,7 @@ mod tests {
std::fs::create_dir_all(&dir).unwrap();
let path = dir.join("behind.png");
image::RgbaImage::from_pixel(16, 16, image::Rgba([0, 0, 220, 255])).save(&path).unwrap();
let mut filter =
BackgroundFilter::with_default_segmenter(Background::Image { path: path.clone() });
let mut filter = oval_filter(Background::Image { path: path.clone() });
let started = Instant::now();
let mut frame = flat_rgba(64, 64, [0, 255, 0, 255]);
while pixel(&frame, 0, 0) != [0, 0, 220, 255] {
@@ -715,8 +876,7 @@ mod tests {
#[test]
fn a_blurred_background_keeps_the_subject_sharp() {
let mut filter =
BackgroundFilter::with_default_segmenter(Background::Blur { strength: 0.1 });
let mut filter = oval_filter(Background::Blur { strength: 0.1 });
filter.set_mask_fps(60);
// A checkerboard, so blurring is visible.
let mut frame = flat_rgba(64, 64, [0, 0, 0, 255]);
+7 -4
View File
@@ -2,8 +2,10 @@
//! (MIT-SHM and GetImage), checks pixels, and sends a window capture through
//! VP8 and back.
//!
//! Needs `DISPLAY` (e.g. `Xvfb :101 -screen 0 1280x720x24 & DISPLAY=:101
//! cargo test -p voelin-media --test x11_capture`); skipped without it.
//! Needs a test X server in `VOELIN_X11_TEST_DISPLAY`, never the desktop's
//! `DISPLAY` (it maps windows and moves the pointer): e.g. `xvfb-run -a bash
//! -c 'VOELIN_X11_TEST_DISPLAY=$DISPLAY cargo test -p voelin-media --test
//! x11_capture'`, as CI does; skipped without it.
#![cfg(all(target_os = "linux", feature = "x11", feature = "vpx"))]
use std::time::Duration;
@@ -150,8 +152,9 @@ async fn check_monitor(capture: &mut X11Capture, scene: &Scene) {
#[tokio::test(flavor = "multi_thread")]
async fn x11_capture_end_to_end() {
let Some(display) = std::env::var("DISPLAY").ok().filter(|d| !d.is_empty()) else {
eprintln!("skipped: DISPLAY is not set");
let Some(display) = std::env::var("VOELIN_X11_TEST_DISPLAY").ok().filter(|d| !d.is_empty())
else {
eprintln!("skipped: VOELIN_X11_TEST_DISPLAY is not set");
return;
};
let scene = Scene::create(&display);
+45 -28
View File
@@ -7,12 +7,17 @@
//! per stream of that client, for any client on the server (see
//! `docs/research/ts6-late-join.md`).
//!
//! The answer works from any channel, and so does `joinstreamrequest`: a
//! client can watch a stream in another channel, as the official client does.
//!
//! [`Discovery`] follows the clients on the server (their channel and
//! streaming flag, fed by [`Streams::update_clients`](crate::Streams::update_clients)),
//! keeps the [`StreamDirectory`] to the streams in our channel, and looks up
//! the streams of clients that stream in our channel but whose stream we were
//! not told: after connecting, after we or they change channels, and when a
//! streamer's announcement did not come. Where it looks them up is a
//! keeps the [`StreamDirectory`] to the streams of clients that are on the
//! server and stream, in any channel, and looks up the streams of clients
//! that stream but whose stream we were not told: after connecting, when a
//! client in another channel starts streaming (the server announces it only
//! in that channel), after we or they change channels, and when a streamer's
//! announcement in our channel did not come. Where it looks them up is a
//! [`StreamLookup`]: the server ([`ServerLookup`]) now; another directory
//! (e.g. a gateway's) can be added with
//! [`Streams::add_lookup`](crate::Streams::add_lookup) and hands what it finds
@@ -118,19 +123,16 @@ impl Discovery {
self.clients.get(&client.0).map(|c| c.channel)
}
/// Whether a stream of `streamer` belongs in the directory: it is in our
/// channel (or the clients are not known yet).
pub fn in_our_channel(&self, streamer: ClientId) -> bool {
match self.own_channel() {
None => true,
Some(own) => self.clients.get(&streamer.0).is_some_and(|c| c.channel == own),
}
/// Whether a stream of `streamer` belongs in the directory: the client is
/// on the server (or the clients are not known yet).
pub fn knows(&self, streamer: ClientId) -> bool {
self.clients.is_empty() || self.clients.contains_key(&streamer.0)
}
/// The clients on the server changed (full list). Updates the streaming
/// flags in `directory`, drops the streams of clients that left or are
/// not in our channel, and looks up the streams we were not told.
/// Returns whether the directory's streams changed.
/// flags in `directory`, drops the streams of clients that left, and
/// looks up the streams we were not told, in every channel. Returns
/// whether the directory's streams changed.
pub fn update(
&mut self,
clients: BTreeMap<u16, ClientState>,
@@ -140,7 +142,7 @@ impl Discovery {
let old_channel = self.own_channel();
let new_channel = clients.get(&self.own.0).map(|c| c.channel);
let mut changed = false;
// Streams announced to us but whose streamer went away or out of our channel.
// Streams announced to us but whose streamer stopped or went away.
let first = self.clients.is_empty();
for (id, now) in &clients {
let was = self.clients.get(id);
@@ -163,9 +165,7 @@ impl Discovery {
self.asked.clear();
}
self.asked.retain(|id| clients.contains_key(id));
changed |= directory.retain_streamers(|c| {
clients.get(&c.0).is_some_and(|s| new_channel.is_none_or(|own| s.channel == own))
});
changed |= directory.retain_streamers(|c| clients.contains_key(&c.0));
// A client in our channel that just started streaming is announced
// by the server itself; look it up only if the announcement has not
@@ -177,12 +177,13 @@ impl Discovery {
was.streaming != Some(true) && Some(was.channel) == old_channel
}) && Some(now.channel) == new_channel
};
// Once we are on the server ourselves: every channel.
let candidates: Vec<u16> = clients
.iter()
.filter(|(id, c)| {
**id != self.own.0
&& c.streaming == Some(true)
&& new_channel.is_some_and(|own| c.channel == own)
&& new_channel.is_some()
&& directory.by_streamer(ClientId(**id)).is_none()
&& !self.asked.contains(id)
&& !just_started(id, c)
@@ -256,9 +257,10 @@ mod tests {
let mut dir = StreamDirectory::default();
let mut out = Outbox::default();
// Connected: 2 streams in our channel, 3 in another one.
// Connected: 2 streams in our channel, 3 in another one; both are
// looked up (a stream can be watched from any channel).
d.update(clients(&[(OWN, 1, false), (2, 1, true), (3, 5, true)]), &mut dir, &mut out);
assert_eq!(looked_up(&mut out), [2]);
assert_eq!(looked_up(&mut out), [2, 3]);
// Asked once, not again on the next update.
d.update(
clients(&[(OWN, 1, false), (2, 1, true), (3, 5, true), (4, 1, false)]),
@@ -266,15 +268,28 @@ mod tests {
&mut out,
);
assert_eq!(looked_up(&mut out), [] as [u16; 0]);
// The answer fills the directory.
// The answers fill the directory.
assert!(dir.apply(&started("s-2", 2)));
assert!(dir.apply(&started("s-3", 3)));
// We move to 3's channel: 3 is looked up, 2's stream leaves the list.
// We move to 3's channel: both streams stay, nothing is asked again.
let moved = clients(&[(OWN, 5, false), (2, 1, true), (3, 5, true), (4, 1, false)]);
assert!(d.update(moved.clone(), &mut dir, &mut out));
assert_eq!(looked_up(&mut out), [3]);
assert!(dir.get("s-2").is_none());
assert!(d.in_our_channel(ClientId(3)) && !d.in_our_channel(ClientId(2)));
assert!(!d.update(moved.clone(), &mut dir, &mut out));
assert_eq!(looked_up(&mut out), [] as [u16; 0]);
assert!(dir.get("s-2").is_some() && dir.get("s-3").is_some());
assert!(d.knows(ClientId(2)) && !d.knows(ClientId(7)));
assert_eq!((d.channel_of(ClientId(2)), d.own_channel()), (Some(1), Some(5)));
// A client in another channel starts streaming: the server does not
// announce it to us, so it is looked up at once.
let mut now = moved.clone();
now.insert(6, ClientState { channel: 1, streaming: Some(false) });
d.update(now.clone(), &mut dir, &mut out);
now.insert(6, ClientState { channel: 1, streaming: Some(true) });
d.update(now.clone(), &mut dir, &mut out);
assert_eq!(looked_up(&mut out), [6]);
now.remove(&6);
d.update(now, &mut dir, &mut out);
// 4 comes to our channel and starts streaming there: announced by
// the server, so not looked up at once...
@@ -294,8 +309,10 @@ mod tests {
now.insert(4, ClientState { channel: 5, streaming: Some(false) });
assert!(d.update(now.clone(), &mut dir, &mut out));
assert!(dir.get("s-4").is_none());
assert!(dir.apply(&started("s-3", 3)));
now.remove(&3);
assert!(d.update(now.clone(), &mut dir, &mut out));
assert!(dir.get("s-3").is_none());
now.insert(2, ClientState { channel: 1, streaming: Some(false) });
assert!(d.update(now, &mut dir, &mut out));
assert_eq!(dir.iter().count(), 0);
}
+12 -4
View File
@@ -282,7 +282,7 @@ impl Peer {
) -> Result<(Self, String), PeerError> {
let start = options.start_bitrate.unwrap_or(DEFAULT_START_BITRATE).max(1);
let bwe = config.bandwidth_estimation.then_some(start);
let (mut rtc, srtp_profile) = build_rtc(config, &config.video_codecs, bwe);
let (mut rtc, srtp_profile) = build_rtc(config, &config.video_codecs, true, bwe);
if bwe.is_some() {
let desired = options.desired_bitrate.unwrap_or(start);
rtc.bwe().set_desired_bitrate(Bitrate::bps(desired));
@@ -333,7 +333,7 @@ impl Peer {
}
}
let offer = SdpOffer::from_sdp_string(offer).map_err(|e| PeerError::Sdp(e.to_string()))?;
let (mut rtc, srtp_profile) = build_rtc(config, &codecs, None);
let (mut rtc, srtp_profile) = build_rtc(config, &codecs, false, None);
let net = Net::bind(config, &mut rtc).await?;
let answer = rtc.sdp_api().accept_offer(offer)?;
let peer = Self::spawn(rtc, net, config, None, Vec::new(), srtp_profile);
@@ -462,10 +462,15 @@ fn simulcast_offer(layers: &[LayerSpec]) -> Option<Simulcast> {
}
/// An RTC with Opus and `video` codecs, in this order of preference, our
/// DTLS, and bandwidth estimation starting at `bwe` bit/s if given.
/// DTLS, and bandwidth estimation starting at `bwe` bit/s if given. An
/// offer lists H.264 only as our encoders produce it (`profile-level-id`
/// [`PeerConfig::h264_profile_level_id`], packetization mode 1): with
/// str0m's other variants offered too, a viewer may answer a profile we
/// never send. An answer takes every variant the offer has.
fn build_rtc(
config: &PeerConfig,
video: &[VideoCodec],
offer: bool,
bwe: Option<u64>,
) -> (Rtc, NegotiatedProfile) {
let mut rtc_config =
@@ -475,7 +480,7 @@ fn build_rtc(
VideoCodec::Vp8 => rtc_config.enable_vp8(true),
VideoCodec::Vp9 => rtc_config.enable_vp9(true),
VideoCodec::H264 => {
let mut c = rtc_config.enable_h264(true);
let mut c = if offer { rtc_config } else { rtc_config.enable_h264(true) };
c.codec_config().add_h264(
112.into(),
Some(113.into()),
@@ -935,6 +940,9 @@ mod tests {
};
let (_peer, offer) = Peer::offer(&streamer, "s").await.unwrap();
assert!(offer.contains("profile-level-id=640c1f"), "{offer}");
// Only the profile we encode: a viewer must not answer another.
let h264 = offer.lines().filter(|l| l.contains(" H264/90000")).count();
assert_eq!(h264, 1, "{offer}");
let (_peer, answer) = Peer::answer(&PeerConfig::loopback(), &offer).await.unwrap();
assert_eq!(offered_video_codecs(&answer)[0], VideoCodec::H264, "{answer}");
let vp8_only =
+8 -7
View File
@@ -1672,10 +1672,10 @@ impl Streams {
/// Feed a stream notification from the connection.
pub async fn handle_notification(&mut self, n: StreamNotification) {
// Looked up streams of clients that have left our channel since.
let elsewhere = matches!(&n, StreamNotification::Info(info)
if !self.discovery.in_our_channel(info.streamer));
if !elsewhere && self.directory.apply(&n) {
// Looked up streams of clients that have left the server since.
let gone = matches!(&n, StreamNotification::Info(info)
if !self.discovery.knows(info.streamer));
if !gone && self.directory.apply(&n) {
self.emit_streams();
}
if let Some(s) = &mut self.streamer
@@ -1706,8 +1706,9 @@ impl Streams {
}
/// The clients on the server changed (full list, with ourselves): keeps
/// the directory to the streams in our channel and looks up the streams
/// the server did not announce to us (see [`crate::discovery`]). Covers
/// the directory to the streams of clients that are on the server and
/// stream, in any channel, and looks up the streams the server did not
/// announce to us (see [`crate::discovery`]). Covers
/// [`Self::set_client_streaming`] and [`Self::retain_streamers`].
pub fn update_clients(&mut self, clients: BTreeMap<u16, ClientState>) {
if self.discovery.update(clients, &mut self.directory, &mut self.out) {
@@ -1717,7 +1718,7 @@ impl Streams {
/// A stream found by another [`StreamLookup`] (e.g. a gateway's directory).
pub fn discovered(&mut self, info: StreamInfo) {
if self.discovery.in_our_channel(info.streamer)
if self.discovery.knows(info.streamer)
&& self.directory.apply(&StreamNotification::Info(info))
{
self.emit_streams();
+10 -69
View File
@@ -4,82 +4,23 @@
//!
//! Runs only with `VOELIN_INTEROP=1` (see `tests/interop/README.md`).
use std::path::PathBuf;
use std::process::Stdio;
use std::time::{Duration, Instant};
use serde_json::{Value, json};
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader, Lines};
use tokio::process::{Child, ChildStdin, ChildStdout, Command};
use serde_json::json;
use tokio::time::timeout;
use voelin_stream::{
Codec, FrameSource, MediaKind, Peer, PeerConfig, PeerEvent, Signal, SrtpProfile,
SyntheticSource,
};
fn enabled() -> bool {
std::env::var("VOELIN_INTEROP").is_ok_and(|v| v == "1")
}
#[path = "../../../tests/interop/browser.rs"]
mod browser;
use browser::{Browser, enabled};
/// The Node.js side (headless Chromium).
struct Browser {
_child: Child,
stdin: ChildStdin,
stdout: Lines<BufReader<ChildStdout>>,
}
impl Browser {
async fn start() -> Self {
let script = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("../../tests/interop/browser-peer.cjs")
.canonicalize()
.expect("tests/interop/browser-peer.cjs");
let node = std::env::var("VOELIN_NODE").unwrap_or_else(|_| "node".into());
let mut command = Command::new(node);
command
.arg(script)
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::inherit())
.kill_on_drop(true);
// Playwright is usually installed globally.
if std::env::var_os("NODE_PATH").is_none()
&& let Ok(out) = std::process::Command::new("npm").args(["root", "-g"]).output()
{
command.env("NODE_PATH", String::from_utf8_lossy(&out.stdout).trim());
}
let mut child = command.spawn().expect("cannot start node (set VOELIN_NODE)");
let stdin = child.stdin.take().unwrap();
let stdout = BufReader::new(child.stdout.take().unwrap()).lines();
let mut browser = Self { _child: child, stdin, stdout };
let ready = browser.read().await;
eprintln!("browser: {}", ready["userAgent"]);
browser
}
async fn read(&mut self) -> Value {
let line = timeout(Duration::from_secs(60), self.stdout.next_line())
.await
.expect("browser did not answer")
.unwrap()
.expect("browser exited");
let value: Value = serde_json::from_str(&line).unwrap();
if let Some(error) = value.get("error") {
panic!("browser: {error}");
}
value
}
async fn call(&mut self, command: Value) -> Value {
let mut line = command.to_string();
line.push('\n');
self.stdin.write_all(line.as_bytes()).await.unwrap();
self.read().await
}
async fn quit(mut self) {
let _ = self.call(json!({ "op": "quit" })).await;
}
/// The `srtpCipher` of `getStats()` for AES_CM_128_HMAC_SHA1_80, as Chromium
/// 141 and 152 name it.
fn aes_cm_128_sha1_80(cipher: &serde_json::Value) -> bool {
["AES_CM_128_HMAC_SHA1_80", "SRTP_AES128_CM_HMAC_SHA1_80"].iter().any(|name| cipher == name)
}
async fn wait_connected(peer: &mut Peer) {
@@ -139,7 +80,7 @@ async fn rust_streams_to_browser() {
eprintln!("browser stats: {stats:#}\nkeyframe requests from the browser: {keyframe_requests}");
eprintln!("bandwidth estimates (bit/s): {estimates:?}");
assert_eq!(stats["connectionState"], "connected");
assert_eq!(stats["transport"]["srtpCipher"], "AES_CM_128_HMAC_SHA1_80", "{stats:#}");
assert!(aes_cm_128_sha1_80(&stats["transport"]["srtpCipher"]), "{stats:#}");
assert_eq!(peer.srtp_profile(), Some(SrtpProfile::Aes128CmSha1_80));
assert!(!estimates.is_empty(), "no bandwidth estimate from the browser's feedback");
let video = &stats["inbound"]["video"];
@@ -329,6 +270,6 @@ async fn browser_streams_to_rust() {
}
assert!(tested.contains(&"VP8") && tested.contains(&"VP9"), "tested {tested:?}");
let stats = browser.call(json!({ "op": "stats" })).await;
assert_eq!(stats["transport"]["srtpCipher"], "AES_CM_128_HMAC_SHA1_80", "{stats:#}");
assert!(aes_cm_128_sha1_80(&stats["transport"]["srtpCipher"]), "{stats:#}");
browser.quit().await;
}
+13
View File
@@ -254,6 +254,19 @@ impl SessionView {
self.capabilities.streams && self.state.voice == VoiceState::Connected
}
/// The channel a client is in.
pub fn channel_of(&self, client: u16) -> Option<u64> {
self.presence.clients.get(&client).map(|c| c.channel)
}
/// The name of a client's channel when it is not ours; empty in ours.
pub fn other_channel_name(&self, client: u16) -> String {
self.channel_of(client)
.filter(|c| Some(*c) != self.state.own_channel)
.and_then(|c| self.presence.channels.get(&c))
.map_or_else(String::new, |c| c.name.clone())
}
/// A client's nickname, or its id.
pub fn nickname(&self, client: u16) -> String {
self.presence
+1 -1
View File
@@ -886,7 +886,7 @@ impl App {
/// The screens and windows that can be shared (Devices).
fn load_capture_sources(&mut self) {
let names: Vec<SharedString> = match self.video.sources(false) {
let names: Vec<SharedString> = match self.video.sources(false, false) {
Ok(list) => list
.into_iter()
.map(|(n, d)| {
+20 -11
View File
@@ -215,7 +215,12 @@ impl App {
let current = self.current;
let mut items: Vec<StreamItem> = Vec::new();
if let Some(view) = view.filter(|v| v.streams_available()) {
for s in &view.streams {
// Every channel's streams (they can be watched from anywhere),
// ours first.
let own_channel = view.state.own_channel;
let mut streams: Vec<_> = view.streams.iter().collect();
streams.sort_by_key(|s| view.channel_of(s.streamer.0) != own_channel);
for s in streams {
let watching = self
.watch
.as_ref()
@@ -224,6 +229,7 @@ impl App {
id: s.id.clone().into(),
name: s.name.clone().into(),
streamer: view.nickname(s.streamer.0).into(),
channel: view.other_channel_name(s.streamer.0).into(),
streamer_id: i32::from(s.streamer.0),
viewers: view.stream_viewers.get(&s.id).map_or(0, |v| *v as i32),
audio: s.audio,
@@ -239,20 +245,17 @@ impl App {
bitrate: bitrate_text(s.bitrate).into(),
});
}
// Streams that started before we joined: the server did not
// announce them, and the engine is looking them up (they arrive
// in `StreamsChanged` like the others). Until then only the
// streaming flag is known.
let channel = view.state.own_channel;
// Streams that started before we joined, or in another channel:
// the server did not announce them, and the engine is looking
// them up (they arrive in `StreamsChanged` like the others).
// Until then only the streaming flag is known.
for c in view.presence.clients.values() {
let announced = view.streams.iter().any(|s| s.streamer.0 == c.id);
if c.streaming == Some(true)
&& Some(c.channel) == channel
&& !announced && view.state.own_client != Some(c.id)
{
if c.streaming == Some(true) && !announced && view.state.own_client != Some(c.id) {
items.push(StreamItem {
name: c.nickname.clone().into(),
streamer: c.nickname.clone().into(),
channel: view.other_channel_name(c.id).into(),
streamer_id: i32::from(c.id),
..StreamItem::default()
});
@@ -346,6 +349,11 @@ impl App {
.and_then(|v| v.streams.iter().find(|s| s.id == watch.stream_id))
.map_or(-1, |s| i32::from(s.streamer.0));
bridge.set_viewer_streamer_id(streamer);
let channel = u16::try_from(streamer).ok().and_then(|id| {
let view = self.view()?;
view.presence.channels.get(&view.channel_of(id)?).map(|c| c.name.clone())
});
bridge.set_viewer_channel(channel.unwrap_or_default().into());
bridge.set_viewer_elapsed(watch.elapsed().into());
let viewers = self.view().and_then(|v| v.stream_viewers.get(&watch.stream_id)).copied();
bridge.set_viewer_count(viewers.unwrap_or(0) as i32);
@@ -414,7 +422,8 @@ impl App {
let test_pattern = cfg!(debug_assertions)
|| self.demo
|| std::env::var("VOELIN_TEST_PATTERN").is_ok_and(|v| v == "1");
let sources = match self.video.sources(test_pattern) {
let restorable = self.settings.portal_restore_token.is_some();
let sources = match self.video.sources(test_pattern, restorable) {
Ok(sources) => {
if self.share.is_none() {
self.share_error.clear();
+77 -26
View File
@@ -10,7 +10,7 @@ use std::sync::Arc;
use slint::{Image, Rgba8Pixel, SharedPixelBuffer};
use tokio::runtime::Handle;
use tracing::warn;
use voelin_core::media::voelin_media::capture::SourceId;
use voelin_core::media::voelin_media::capture::{CaptureSource, SourceId};
use voelin_core::media::voelin_media::{Codec, Codecs, VideoFrame, convert};
use voelin_core::media::{
self, AudioSourceSpec, EncoderPreference, Latest, LocalPreview, Streamer, StreamerConfig,
@@ -63,7 +63,7 @@ pub(crate) struct Video {
encoder: EncoderPreference,
codec: Option<Codec>,
/// Sources of the share dialog, by index.
sources: Vec<(SourceId, String)>,
sources: Vec<ShareEntry>,
}
impl Video {
@@ -192,8 +192,14 @@ impl Video {
}
/// Screens and windows to share, as (name, detail); the test pattern too
/// when asked for.
pub fn sources(&mut self, test_pattern: bool) -> Result<Vec<(String, String)>, String> {
/// when asked for. With `restorable` (a portal restore token from an
/// earlier share) the portal comes twice: its dialog, which always asks,
/// and the last choice again without the dialog.
pub fn sources(
&mut self,
test_pattern: bool,
restorable: bool,
) -> Result<Vec<(String, String)>, String> {
let mut error = None;
let mut sources = match media::screen_sources() {
Ok(list) => list,
@@ -208,26 +214,9 @@ impl Video {
if sources.is_empty() {
return Err(error.unwrap_or_else(|| "Nothing to share was found.".into()));
}
self.sources = sources.iter().map(|s| (s.id.clone(), s.name.clone())).collect();
Ok(sources
.iter()
.map(|s| {
let name = match s.id {
SourceId::Portal => "Choose via system dialog".to_owned(),
_ => s.name.clone(),
};
let detail = match (&s.id, s.primary) {
(SourceId::Monitor(_), true) => {
format!("{} · primary", size_text(s.width, s.height))
}
(SourceId::Window(_), _) => {
format!("window {}", size_text(s.width, s.height)).trim().to_owned()
}
_ => size_text(s.width, s.height),
};
(name, detail)
})
.collect())
let (rows, entries) = share_rows(&sources, restorable);
self.sources = entries;
Ok(rows)
}
/// Start capturing source `index` of [`Video::sources`]; `done` runs on
@@ -239,7 +228,7 @@ impl Video {
options: CaptureRequest,
done: impl FnOnce(Result<Capture, String>) + Send + 'static,
) {
let Some((source, name)) = self.sources.get(index).cloned() else {
let Some((source, name, restore)) = self.sources.get(index).cloned() else {
done(Err("Pick something to share.".into()));
return;
};
@@ -257,7 +246,8 @@ impl Video {
encoder: self.encoder.clone(),
audio: options.audio,
audio_sources: options.audio_sources,
restore_token: options.restore_token,
// The portal skips its dialog with a token: only when asked to.
restore_token: options.restore_token.filter(|_| restore),
..StreamerConfig::default()
};
runtime.spawn(async move {
@@ -361,6 +351,40 @@ fn deliver(
}
}
/// What a row of the share dialog starts: the source, its name, and whether
/// to restore the portal's last choice instead of asking.
type ShareEntry = (SourceId, String, bool);
/// The share dialog's rows (name, detail) for `sources`, and what each row
/// starts (restoring only in the extra portal row with `restorable`).
fn share_rows(
sources: &[CaptureSource],
restorable: bool,
) -> (Vec<(String, String)>, Vec<ShareEntry>) {
let mut rows = Vec::with_capacity(sources.len() + 1);
let mut entries = Vec::with_capacity(sources.len() + 1);
for s in sources {
let name = match s.id {
SourceId::Portal => "Choose via system dialog".to_owned(),
_ => s.name.clone(),
};
let detail = match (&s.id, s.primary) {
(SourceId::Monitor(_), true) => format!("{} · primary", size_text(s.width, s.height)),
(SourceId::Window(_), _) => {
format!("window {}", size_text(s.width, s.height)).trim().to_owned()
}
_ => size_text(s.width, s.height),
};
rows.push((name, detail));
entries.push((s.id.clone(), s.name.clone(), false));
if s.id == SourceId::Portal && restorable {
rows.push(("Same as last time".to_owned(), "without the dialog".to_owned()));
entries.push((s.id.clone(), s.name.clone(), true));
}
}
(rows, entries)
}
/// Share settings from the dialog.
pub(crate) struct CaptureRequest {
pub fps: u32,
@@ -466,3 +490,30 @@ impl Decoder {
stats.error.filter(|_| stats.decoded == 0)
}
}
#[cfg(test)]
mod tests {
use super::*;
/// "Choose via system dialog" never passes the restore token, so the
/// portal always asks; with a token the last choice gets its own row.
#[test]
fn the_portal_dialog_always_asks() {
let portal = CaptureSource {
id: SourceId::Portal,
name: "Screen".into(),
width: 0,
height: 0,
primary: false,
};
let (rows, entries) = share_rows(std::slice::from_ref(&portal), false);
assert_eq!(rows.len(), 1);
assert_eq!(rows[0].0, "Choose via system dialog");
assert!(!entries[0].2);
let (rows, entries) = share_rows(&[portal], true);
let names: Vec<_> = rows.iter().map(|(name, _)| name.as_str()).collect();
assert_eq!(names, ["Choose via system dialog", "Same as last time"]);
let restore: Vec<_> = entries.iter().map(|e| e.2).collect();
assert_eq!(restore, [false, true]);
}
}
+7 -2
View File
@@ -225,12 +225,15 @@ export struct BookmarkForm {
query-password: string,
}
// A stream in our channel. An empty id: a client that streams, but whose
// stream is still being looked up (it started before we joined).
// A stream on the server, ours first: a stream can be watched from any
// channel. An empty id: a client that streams, but whose stream is still
// being looked up (it started before we joined, or in another channel).
export struct StreamItem {
id: string,
name: string,
streamer: string,
// The streamer's channel when it is not ours; empty in ours.
channel: string,
// The streamer's client id (their avatar in the members).
streamer-id: int,
// How many watch it (the gateway's directory; 0 unknown).
@@ -817,6 +820,8 @@ export global Bridge {
in property <string> viewer-title;
// Who streams it (their client id: -1 unknown).
in property <string> viewer-streamer;
// The voice channel the watched stream is in.
in property <string> viewer-channel;
in property <int> viewer-streamer-id: -1;
// Shown instead of (or over) the picture: waiting, ended, errors.
in property <string> viewer-status;
+11 -5
View File
@@ -9,6 +9,8 @@ import { Icon, Button, ButtonKind, IconButton, Avatar, Status, CountBadge, LiveB
import { ServerHeader, ConnectActions, ChannelTree } from "channels.slint";
import { StreamsPanel } from "streams.slint";
import { VoiceCard, VoiceButtons } from "../shells/common.slint";
import { StudioBridge } from "../studio-bridge.slint";
import { ShareMenu } from "../share-menu.slint";
// Servers as a horizontal strip, the current server, its channels.
export component MobileServers inherits VerticalLayout {
@@ -166,11 +168,15 @@ export component YouPage inherits ScrollView {
enabled: Bridge.voice-connected;
clicked => { Bridge.set-output-muted(!Bridge.output-muted); }
}
if Bridge.streams-available && Bridge.can-share: ActionButton {
icon: Icons.radio;
text: Bridge.share-state == "live" ? @tr("Live") : @tr("Go Live");
checked: Bridge.share-state == "live";
clicked => { Nav.open-share(); }
// A screen or the Stream Studio (ShareMenu).
if Bridge.streams-available && Bridge.can-share: VerticalLayout {
live := ActionButton {
icon: Icons.radio;
text: Bridge.share-state == "live" || StudioBridge.status.live ? @tr("Live") : @tr("Go Live");
checked: Bridge.share-state == "live" || StudioBridge.status.live;
clicked => { share-menu.open(0, - live.height - share-menu.menu-height - 4px); }
}
share-menu := ShareMenu { }
}
ActionButton {
icon: Icons.phone-off;
+10 -6
View File
@@ -50,7 +50,10 @@ component StreamCard inherits Rectangle {
overflow: elide;
}
Text {
text: stream.id == "" ? @tr("Started before you joined; looking it up…") : stream.own ? @tr("your stream") : stream.audio ? @tr("by {} · with sound", stream.streamer) : @tr("by {}", stream.streamer);
text: stream.id == "" ? (stream.channel == "" ? @tr("Started before you joined; looking it up…") : @tr("In {}; looking it up…", stream.channel))
: stream.own ? @tr("your stream")
: stream.channel != "" ? @tr("by {} · in {}", stream.streamer, stream.channel)
: stream.audio ? @tr("by {} · with sound", stream.streamer) : @tr("by {}", stream.streamer);
color: Theme.text-muted;
font-size: Theme.font-sm;
overflow: elide;
@@ -150,7 +153,7 @@ export component StreamsPanel inherits VerticalLayout {
}
}
if Bridge.streams.length == 0: Text {
text: @tr("No streams in your channel.");
text: @tr("No streams on this server.");
color: Theme.text-muted;
font-size: Theme.font-sm;
}
@@ -425,7 +428,7 @@ component StreamInfo inherits VerticalLayout {
}
// The stream we watch. With the shell: the channel's header, the player,
// a note that the stream belongs to the channel, and its chat below. In
// a note on the channel the stream belongs to, and its chat below. In
// full screen and on a phone: the player alone.
export component StreamViewer inherits Rectangle {
// Reading our own width here would loop through the layout, so the
@@ -465,8 +468,9 @@ export component StreamViewer inherits Rectangle {
padding-bottom: Theme.space-3;
StreamPlayer { }
}
// Streams on TeamSpeak belong to the channel.
if Bridge.own-channel != "": HorizontalLayout {
// Streams on TeamSpeak belong to a channel (and can be watched from
// any channel; the streamer decides who may).
if Bridge.viewer-channel != "": HorizontalLayout {
padding-left: Theme.space-4;
padding-right: Theme.space-4;
Rectangle {
@@ -486,7 +490,7 @@ export component StreamViewer inherits Rectangle {
y: (parent.height - self.height) / 2;
}
Text {
text: @tr("This stream is only available while you're in the {} voice channel.", Bridge.own-channel);
text: Bridge.viewer-channel == Bridge.own-channel ? @tr("Streamed in your voice channel, {}. The streamer decides who may watch.", Bridge.viewer-channel) : @tr("Streamed in the {} voice channel. The streamer decides who may watch.", Bridge.viewer-channel);
color: Theme.text-secondary;
font-size: Theme.font-sm;
vertical-alignment: center;
+42
View File
@@ -0,0 +1,42 @@
// What a Share button opens: a quick share of a screen or a window (the
// share dialog) or the Stream Studio. While a share runs it opens the share
// dialog right away, to manage it.
import { Theme } from "theme.slint";
import { Icons } from "icons.slint";
import { PopupMenu } from "components/index.slint";
import { Bridge } from "bridge.slint";
import { StudioBridge } from "studio-bridge.slint";
import { Nav } from "nav.slint";
export component ShareMenu inherits Rectangle {
// The menu's height, to open it above a button.
out property <length> menu-height: 2 * Theme.control-height + 2 * Theme.space-2 + 2px;
width: 0;
height: 0;
// Open at (x, y), relative to this element.
public function open(x: length, y: length) {
if Bridge.share-state == "live" || Bridge.share-state == "starting" {
Nav.open-share();
} else {
menu.show(x, y);
}
}
menu := PopupMenu {
menu-width: 220px;
entries: [
// The studio's stream takes the place of a simple share.
{ text: @tr("Share screen"), icon: Icons.monitor-up, enabled: !StudioBridge.status.live },
{ text: @tr("Stream Studio"), icon: Icons.radio, enabled: true },
];
activated(i) => {
if i == 0 {
Nav.open-share();
} else {
Nav.open-studio();
}
}
}
}
+12 -6
View File
@@ -4,6 +4,8 @@ import { Theme } from "../theme.slint";
import { Icons } from "../icons.slint";
import { Bridge } from "../bridge.slint";
import { Nav, SettingsSection } from "../nav.slint";
import { StudioBridge } from "../studio-bridge.slint";
import { ShareMenu } from "../share-menu.slint";
import { Icon, IconButton, Avatar, Status } from "../components/index.slint";
// A rounded panel of the frame (sidebar, main area, right panel).
@@ -131,12 +133,16 @@ export component VoiceButtons inherits HorizontalLayout {
enabled: Bridge.voice-connected;
clicked => { Bridge.set-output-muted(!Bridge.output-muted); }
}
if Bridge.streams-available && Bridge.can-share: IconButton {
icon: Icons.monitor-up;
label: Bridge.share-state == "live" ? @tr("Sharing") : @tr("Share screen");
checked: Bridge.share-state == "live";
size: root.size;
clicked => { Nav.open-share(); }
// A screen or window, or the Stream Studio (ShareMenu).
if Bridge.streams-available && Bridge.can-share: VerticalLayout {
IconButton {
icon: Icons.monitor-up;
label: Bridge.share-state == "live" ? @tr("Sharing") : StudioBridge.status.live ? @tr("Live in the Stream Studio") : @tr("Share or go live");
checked: Bridge.share-state == "live" || StudioBridge.status.live;
size: root.size;
clicked => { share-menu.open(0, - root.size - share-menu.menu-height - 4px); }
}
share-menu := ShareMenu { }
}
IconButton {
icon: Icons.settings;
-7
View File
@@ -222,13 +222,6 @@ export component TopBar inherits Rectangle {
y: (parent.height - self.height) / 2;
clicked => { Nav.notifications-open = !Nav.notifications-open; }
}
IconButton {
icon: Icons.radio;
label: @tr("Stream Studio");
checked: Nav.page == Page.studio;
y: (parent.height - self.height) / 2;
clicked => { Nav.open-studio(); }
}
IconButton {
icon: Icons.users;
label: @tr("Members");
-9
View File
@@ -117,15 +117,6 @@ export component MobileShell inherits Rectangle {
overflow: elide;
}
}
IconButton {
icon: Icons.radio;
label: @tr("Stream Studio");
round: true;
filled: true;
checked: Nav.page == Page.studio;
y: (parent.height - self.height) / 2;
clicked => { Nav.open-studio(); }
}
IconButton {
icon: Icons.search;
label: @tr("Search");
+16 -8
View File
@@ -159,18 +159,26 @@ viewer: Engine::subscribe_frames ─ VideoPipeline (thread) ─ VideoDecoder
- `peer_config(&codecs, config)` makes a viewer accept only what we decode
and a streamer offer its stream codec (the first of `config.video_codecs`
it can encode) followed by `offer_codecs`: the codecs of hardware
encoders, VP8 through libvpx (every TeamSpeak client decodes it), and HEVC
encoders and VP8 through libvpx that every TeamSpeak client decodes
(`decoded_everywhere`: AV1, VP9, VP8), then H.264 from hardware, and HEVC
last. Other software encoders (x264, SVT-AV1, libvpx VP9, ...) are only
ever the stream codec, so a viewer's answer never starts an expensive
second encoder. Answers keep the offer's order, so viewers take the stream
codec when they decode it. `preferred_codec(&codecs, configured)` picks the
stream codec: `stream.codec` if encodable, else the preference's first
(hardware first when enabled, VP8 in software; never HEVC);
`encoder_preference(&settings)` and `configured_codec(&settings)` read the
settings. H.264 is offered as Constrained High at the level the stream
needs (`PeerConfig::set_h264_format(profile, width, height, fps, bitrate)`:
codec every TeamSpeak client decodes (hardware first when enabled, VP8 in
software), else any but HEVC; `encoder_preference(&settings)` and
`configured_codec(&settings)` read the settings. The official client
decodes H.264 only with an OpenH264 library it downloads at start-up; when
that fails it still answers H.264 and shows nothing (see
`docs/protocol-notes/ts6-streaming.md`), so H.264 never comes before a
codec it always decodes. H.264 is offered as one variant, Constrained High
(packetization mode 1) at the level the stream needs
(`PeerConfig::set_h264_format(profile, width, height, fps, bitrate)`:
macroblocks per second and per frame, and bitrate, per H.264 Table A-1;
never below 3.1, the level offered before).
never below 3.1, the level offered before); str0m's other H.264 variants
are only accepted, never offered, so a viewer cannot answer a profile we
do not send.
- `VideoPipeline` decodes on its own thread. It starts at a keyframe, and
after a lost frame (`contiguous == false`, a lagging frame bus, a queue
longer than 30 frames) or a decoder error it skips to the next keyframe,
@@ -909,7 +917,7 @@ has not run on Windows yet.
| OpenH264 download, SHA-256 check, reuse | `tests/openh264.rs -- --ignored` | tested locally (network) |
| H.264 library missing / unknown file | unit + integration tests | tested |
| AV1 decoder construction, garbage input | unit test (`--features av1`) | tested; streams of SVT-AV1, rav1e, libaom, `av1_vaapi` and `av1_amf` decoded (rows below) |
| X11 capture (MIT-SHM and GetImage), sources, window capture → VP8 → decode, cursor | `tests/x11_capture.rs` under Xvfb | tested |
| X11 capture (MIT-SHM and GetImage), sources, window capture → VP8 → decode, cursor | `tests/x11_capture.rs` under Xvfb (`VOELIN_X11_TEST_DISPLAY`) | tested |
| wlroots capture (wlr-screencopy v3): outputs, pixels, a change arriving as a new frame, queue API | `tests/wlroots_capture.rs` against headless sway 1.9 (`VOELIN_WLROOTS_TEST_DISPLAY`) | tested; the ext-image-copy-capture path is untested (sway 1.9 predates it) |
| Converter (strides, unpadded last row, odd sizes, RGBA/I420/NV12), scaler (flat, area average, half), pyramid (sharing, recycling, steady-state pools) | unit tests | tested |
| Simulcast layers (sizes, fps caps, per-layer keyframes), reconfigure (codec, layers, fps) | `voelin-core` `media::tests::simulcast_layers_and_reconfigure` | tested |
@@ -947,7 +955,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 |
| X11 `_NET_WM_PID` of the shared window | `tests/x11_capture.rs` under Xvfb | tested |
| 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) |
| The same through the TeamSpeak 6 server | `voelin-core/tests/media_live.rs` (`VOELIN_LIVE=1`), `voelinctl stream start --synthetic` / `watch --expect-frames` | tested against 6.0.0-beta13.1 |
+35 -4
View File
@@ -38,7 +38,8 @@ Transport (**reported**, TeamSpeak staff on community.teamspeak.com):
Codecs (**reported**, from the ts6-manager bot's working code):
- Video: H.264 Constrained High (the only H.264 profile the TS client decodes),
VP8, VP9, AV1.
VP8, VP9, AV1. H.264 only when the client could download OpenH264 (see
"Codecs the official client decodes" below).
- Audio: Opus, 48 kHz stereo, payload type 111.
Commands over the normal client command channel (**reported**, ts6-manager,
@@ -231,6 +232,36 @@ libwebrtc, the stack the official client is built on:
feedback gives estimates; the offer is the same as without (str0m always
offers transport-cc and abs-send-time).
### Codecs the official client decodes (confirmed, client 6.0.0-beta4.1, 2026-10-03)
From the official Linux client's log (`~/.cache/TeamSpeak/Default/logs/`)
while it watched a Voelin stream, and the symbols of its binary:
- At start-up it downloads Cisco's OpenH264
(`http://ciscobinary.openh264.org/libopenh264-2.6.0-linux64.8.so.bz2`); here
the download failed (`Failed to download openh264 binary http code: 403`).
- Voelin offered H.264 first (the hardware encoder's codec), with every H.264
variant str0m knows. The client answered H.264 `profile-level-id=42e01f`
(packetization mode 1), then could not make a decoder for it: `Trying to
create decoder for unsupported format. Codec name: H264` — libwebrtc's
`NullVideoDecoder`, nothing shown. Its SDP capabilities list H.264 whether
or not OpenH264 loaded.
- Its decoders: `FFmpegDecoderVP8`, `FFmpegDecoderVP9`, `FFmpegDecoderAV1`
(FFmpeg bundled in `/opt/teamspeak`, dav1d and libaom linked in), AMF
hardware decoders for H.264 and AV1, and OpenH264 (`H264DecoderImpl`) once
downloaded. VP8, VP9 and AV1 therefore always decode; H.264 depends on the
download.
- It answers with the first codec of the offer it lists, like Chromium.
Voelin now offers codecs every client decodes first (`decoded_everywhere`)
and H.264 only in the profile it encodes. The real encoders' streams (VA-API
H.264 and AV1, from memory and from DMA-BUFs; libvpx VP8 and VP9; x264,
SVT-AV1, libaom) decode in Chromium 152's libwebrtc at full size
(`crates/voelin-core/tests/browser_codecs.rs`). Watching such a stream with
the official client itself is still to be confirmed: the beta needs a
myTeamSpeak sign-in on first start, so it cannot run from a throwaway
profile.
## Open questions
- [x] Viewer side: `joinstreamrequest id clid msg is_remove` (see above).
@@ -242,9 +273,9 @@ libwebrtc, the stack the official client is built on:
- [x] Whether a client that connects later is told about running streams: no (see above).
- [x] How a client finds running streams after connecting: `requeststreaminfo`
(presumably what the official client does too; not captured from it).
- [ ] Interop with the official TS6 client (its offer/answer details, codecs it
actually picks, whether it trickles candidates, mDNS host candidates).
Chromium's WebRTC stack interoperates (see above).
- [ ] Interop with the official TS6 client (its offer/answer details, whether
it trickles candidates, mDNS host candidates). The codecs it picks and
decodes are known (see above); Chromium's WebRTC stack interoperates.
- [ ] Whether stream audio can be sent without video.
- [ ] The WebRTC/protobuf transport some TS6 clients use on UDP 9987
(`client_protocol_format=proto`, reported in community reverse engineering).
+16 -2
View File
@@ -174,9 +174,12 @@ for A. So metadata would work as a fallback between Voelin clients, but
optional `id` for the empty answer) and `notifystreamupdated`.
- `voelin_stream::discovery::Discovery` follows the clients on the server:
their channel and `client_is_streaming`. It keeps the stream directory to
the streams in our own channel. It looks up a client that streams in our
channel and whose stream we were not told:
the streams of every client on the server that streams, in any channel
(a stream can be watched from another channel, see below). It looks up a
client that streams and whose stream we were not told:
- after connecting;
- when a client in another channel starts streaming (the server announces
a stream only in its channel);
- after we or the streamer change channels;
- when a streamer in our channel starts and its `notifystreamstarted`
has not arrived by the next update of the client list.
@@ -194,6 +197,17 @@ for A. So metadata would work as a fallback between Voelin clients, but
- The engine (`voelin-core`) and `voelinctl stream list/watch` feed the
client list into `Streams::update_clients`.
Watching from another channel (confirmed, 6.0.0-beta13.1, 2026-10-03): with
B in the default channel and A's stream in another one, `requeststreaminfo
clid=<A>` answers as above and `joinstreamrequest` reaches A
(`notifyjoinstreamrequest`), the probe above shows it. The whole join with
media works too: `scripts/it-smoke.sh`, step "late stream", has a viewer in
the default channel watch a stream in `smoke-elsewhere`, and the app (no
gateway) listed and played a stream in another channel. Voelin lists the
streams of every channel, ours first; as a streamer with `stream.permissions
= channel` (the default) it lets its channel in and asks the user about
viewers from other channels.
Fallbacks (i) and (ii) from the plan were not built, because the native
command works. (i) would have been a re-announcement by the streamer; (ii)
would have put the stream id into `client_meta_data`. The probe shows what
+16 -9
View File
@@ -43,7 +43,7 @@ the UI) and a `background` (replacement, below).
|---|---|---|
| `screen` | `monitor`, `backend` (`portal`, `wlroots`, `x11`, `windows`; none: this session's), `cursor` | a capture backend, frames borrowed and copied into pooled frames |
| `window` | `handle` (X11 id, `HWND`), `backend`, `cursor` | the same |
| `portal` | `restore_token`, `cursor` | the ScreenCast portal's dialog (Wayland); the token is written back so it is asked once |
| `portal` | `restore_token`, `cursor` | the ScreenCast portal's dialog (Wayland); with a `restore_token` the portal may restore its last choice without asking. The UI adds portal sources without one, so the dialog asks each time the source starts |
| `camera` | `device` (a `camera::Camera::id`; empty: the first), `size`, `fps`, `mirror` | see [Cameras](#cameras) |
| `image` | `path` | PNG or JPEG, alpha kept, read once |
| `text` | `text`, `font` (none: the bundled Inter), `size_px`, `colour`, `backdrop`, `align`, `padding` | rasterised once with `ab_glyph` |
@@ -123,13 +123,19 @@ blur is a three-pass box blur (close to a Gaussian), separable, with a
running sum so its cost does not grow with the radius, in bands on a worker
pool over pooled buffers.
**What segments today is not a person.** `segment::Ellipse`, the segmenter
that is always there, is a centred oval about where a person sits in front
of a camera. A person segmentation model (MediaPipe selfie segmentation,
Apache-2.0, through `tract-onnx`) is meant to sit behind the `Segmenter`
trait; it is not in this build, because the model could not be fetched where
this was built (see [Status](#status)). Dropping it in changes nothing on the
frame path.
The person is found by `segment::HumanSeg` (feature `segment`, on by
default): PP-HumanSeg, PaddleSeg's portrait segmentation model as OpenCV Zoo
ships it (`crates/voelin-media/models/`, 6 MB, Apache-2.0, bundled into the
binary), run on the CPU by `tract-onnx`. The frame is squeezed to 192x192 RGB;
the mask is the model's probability of a person per pixel, 192x192, which
the frame path stretches back over the frame (its soft edge is the
feathering). The model is parsed and optimised once per process, on the
segmentation thread when the first mask is due; one mask then takes about
50 ms on one core of a desktop CPU (dev builds optimise tract too), so the
10 masks a second cost about half a core. If the model does not load,
`segment::Ellipse`, a centred oval about where a person sits in front of a
camera, stands in (and builds without `segment` use it). Other models drop
in behind the `Segmenter` trait without changing the frame path.
## Outputs (`studio::output`)
@@ -290,6 +296,7 @@ two threads) takes about 3 ms at its own rate (15 fps by default).
| Real camera through the user's PipeWire (Fifine K420, 1280x720) | `camera::tests::a_real_camera_delivers` (`--ignored`) | tested on one webcam |
| Camera through the XDG Camera portal (sandboxes) | – | compiles only |
| Screen, window and portal sources | the existing capture backends ([media.md](media.md#capture)) | as tested there; not run inside the studio here |
| Background blur, image and colour backdrops on the oval mask | `segment::tests` | tested; **no person segmentation model** (see above) |
| 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 and Android cameras | – | not implemented: `camera::list()` has only the test pattern there |
| RTMP | – | the seam only (refuses with its reason) |
+3 -1
View File
@@ -149,7 +149,9 @@ Activity tab.
![Stream Studio](screenshots/desktop-studio-live.png)
The studio (mockups 09, 10 and the phone's 04) is a page of the main window
(the radio button in the top bar), a window of its own (the button in its
(the Share button's menu: "Share screen" for a quick share of a screen or
window, "Stream Studio" for the studio; while a share runs the button opens
its dialog), a window of its own (the button in its
header; closing that window brings it back) and a phone page. Its controller
is `src/studio.rs` on the engine's studio ([studio.md](studio.md)): the
studio runs while it is shown, live or recording, and a `Streamer` started
+28 -1
View File
@@ -22,7 +22,8 @@
# later finds it there and watches it
# 11. stream (TeamSpeak 6 only): a viewer watches a synthetic VP8 + Opus stream
# 12. late stream (TeamSpeak 6 only): a viewer that connects after the stream
# started finds it (requeststreaminfo) and watches it
# started finds it (requeststreaminfo) and watches it; a viewer in the
# default channel finds and watches a stream in another channel
# 13. the engine's voice features (voelinctl engine): upload a file and
# post its link in chat, another client lists the channel's files and
# downloads the linked file (compared byte for byte), the file is
@@ -171,6 +172,31 @@ stream_late_check() {
grep -E "watching|received" "$out"
}
# TeamSpeak 6: the stream runs in another channel. The server announces a
# stream only in its channel; a viewer elsewhere looks it up and watches it
# from where it is, as the official client can.
stream_elsewhere_check() {
local addr=$1 admin=$2 out="$STATE_DIR/stream-elsewhere-watch.log"
local streamer_out="$STATE_DIR/stream-elsewhere-start.log" streamer="far-$$-$RANDOM"
# Semi-permanent, so it outlives this command; it already exists after the first run.
# shellcheck disable=SC2086
"$VOELINCTL" connect "$addr" $admin --nick admin raw \
"channelcreate channel_name=smoke-elsewhere channel_flag_semi_permanent=1" >/dev/null 2>&1 || true
"$VOELINCTL" connect "$addr" --nick "$streamer" --channel smoke-elsewhere stream --loopback start \
--synthetic --auto-accept --seconds 30 >"$streamer_out" 2>&1 &
local streamer_pid=$!
for _ in $(seq 1 60); do grep -q "is live" "$streamer_out" 2>/dev/null && break; sleep 0.25; done
grep -q "is live" "$streamer_out" || { cat "$streamer_out"; fail "streamer in another channel did not go live"; }
if ! "$VOELINCTL" connect "$addr" --nick "elsewhere-$$" stream --loopback watch --streamer-nick "$streamer" \
--expect-frames 60 --timeout 25 >"$out" 2>&1; then
cat "$out" "$streamer_out"
fail "viewer in the default channel did not receive the stream in another channel"
fi
kill -INT "$streamer_pid" 2>/dev/null || true
wait "$streamer_pid" 2>/dev/null || true
grep -E "watching|received" "$out"
}
# An observer over ServerQuery must see a voice client join.
presence_check() {
local addr=$1 query=$2 out="$STATE_DIR/observe.log"
@@ -488,6 +514,7 @@ for svc in "${SERVERS[@]}"; do
if [[ $svc == ts6 ]]; then
stream_check "$addr"
stream_late_check "$addr"
stream_elsewhere_check "$addr" "$admin"
fi
done
+26 -4
View File
@@ -1,15 +1,19 @@
# Browser interop test
`crates/voelin-stream/tests/browser_interop.rs` checks our str0m peers against
the WebRTC stack of Chromium (libwebrtc, the same stack as the official
`crates/voelin-stream/tests/browser_interop.rs` checks our str0m peers, and
`crates/voelin-core/tests/browser_codecs.rs` our real encoders, against the
WebRTC stack of Chromium (libwebrtc, the same stack as the official
TeamSpeak 6 client). `browser-peer.cjs` runs headless Chromium through
Playwright and exchanges SDP and candidates with the Rust test as JSON lines
on stdin/stdout. No TeamSpeak server is involved.
Playwright and exchanges SDP and candidates with the Rust tests as JSON lines
on stdin/stdout (`browser.rs` is the Rust side, shared by both tests). No
TeamSpeak server is involved.
| Test | What it checks |
|---|---|
| `rust_streams_to_browser` | Our streamer offer (`PeerConfig::loopback()`, VP8 + Opus) answered by an `RTCPeerConnection`; `SyntheticSource` media for 3 s; `inbound-rtp` stats: VP8 packets and bytes, decoded frames (the synthetic frames are real 1x1 VP8 keyframes), Opus packets; the `transport` stats' `srtpCipher` is `AES_CM_128_HMAC_SHA1_80` (our SRTP order, we are the DTLS server); our bandwidth estimation gets estimates from Chromium's transport-cc feedback |
| `browser_streams_to_rust` | Chromium offers a canvas `captureStream` and an oscillator with VP8, VP9, H264 and AV1 preferred in turn (codecs the browser cannot send are skipped); our viewer `Peer::answer` must receive frames of that codec and Opus, over `AES_CM_128_HMAC_SHA1_80`. VP8 also uses trickled browser candidates and checks that a PLI brings a keyframe |
| `real_encoders_decode_in_browser` (voelin-core) | Every encoder this machine has (`Codecs::encoders()`), as a share uses it: the 1280x720 test pattern through the `Streamer`, VA-API encoders also from DMA-BUFs as the ScreenCast portal hands over the screen; our streamer peer offers that codec alone (H.264 as Constrained Baseline, see below); the browser must decode at least 60 frames at 1280x720 in 3 s. Codecs the browser does not answer (HEVC, H.264 in Playwright's Chromium) are skipped |
| `share_offer_picks_a_codec_every_client_decodes` (voelin-core) | The offer a share makes on this machine (`preferred_codec`, `peer_config`): the browser, answering with the first codec of the offer it lists as the official client does, must pick one every TeamSpeak client decodes (`decoded_everywhere`), and decode it |
| `trickled_candidates_reach_browser` | A server-reflexive candidate (from a fake STUN server) as our sessions trickle it (`iceCandidate` signal with the peer's mid) is accepted by `addIceCandidate` |
## Running
@@ -20,8 +24,16 @@ elsewhere).
```sh
VOELIN_INTEROP=1 cargo test -p voelin-stream --test browser_interop -- --nocapture
VOELIN_INTEROP=1 cargo test -p voelin-core --features media-desktop --test browser_codecs -- --nocapture
```
Without Playwright's own browsers, `playwright-core` drives an installed
Chromium: `npm install playwright-core` somewhere, then
`NODE_PATH=<that>/node_modules VOELIN_CHROMIUM=/usr/bin/chromium`. A system
Chromium usually decodes H.264, which Playwright's build does not. Run it
headless and away from the desktop session, e.g. with `WAYLAND_DISPLAY` and
`DISPLAY` unset under `dbus-run-session`.
Without `VOELIN_INTEROP=1` the tests return immediately, so `cargo test` passes on
machines without a browser. `VOELIN_NODE` selects the node binary; `NODE_PATH`
defaults to `npm root -g` so a global Playwright is found.
@@ -49,6 +61,16 @@ may do the same; see `docs/protocol-notes/ts6-streaming.md`.
(`PeerConfig::srtp_profiles`) the connection uses AES_CM_128_HMAC_SHA1_80
(`getStats()` transport: `srtpCipher`, DTLS 1.2 `FEFD`,
`TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256`). Before, dimpl picked AES-256-GCM.
Chromium 152 names the same cipher `SRTP_AES128_CM_HMAC_SHA1_80`.
- Chromium 152 (Arch Linux build) decodes every encoder's stream on this
machine (AMD, VA-API): H.264 and AV1 from VA-API (from memory and from
DMA-BUFs), VP8 and VP9 from libvpx, x264, SVT-AV1 and libaom, all at
1280x720, about 100 frames in 3.4 s, no freezes.
- Headless Chromium 152 lists H.264 only in the profiles of libwebrtc's
software decoder (Baseline, Constrained Baseline, Main, packetization modes
0 and 1): it does not answer an offer of Constrained High alone
(`640c1f`, what our streamers offer), yet decodes High profile streams
when it negotiated another profile (its decoder is FFmpeg's).
- With str0m's bandwidth estimation and pacer on our streamer peer, Chromium's
transport-cc feedback yields estimates within the first second (about
640 kbit/s rising towards the desired bitrate with the 720 kbit/s synthetic
+12 -3
View File
@@ -10,14 +10,22 @@
// candidates candidates gathered so far -> {candidates: [{candidate, sdpMid, sdpMLineIndex}]}
// accept {sdp} apply the answer to our offer
// candidate {candidate, sdpMid, sdpMLineIndex} add a remote candidate
// stats connection state, inbound/outbound RTP counters,
// stats connection state, inbound/outbound RTP counters
// (incl. the decoder and decoded frame size),
// frames shown by a <video> element, the DTLS/SRTP
// parameters of the transport
// quit
'use strict';
const readline = require('node:readline');
const { chromium } = require('playwright');
// Playwright, or playwright-core driving a browser it did not download
// (`VOELIN_CHROMIUM`, e.g. a system Chromium that decodes H.264).
let chromium;
try {
({ chromium } = require('playwright'));
} catch {
({ chromium } = require('playwright-core'));
}
// Runs in the page.
const PAGE_SCRIPT = `
@@ -151,7 +159,7 @@ window.peer = {
out.transport = {};
['dtlsState', 'dtlsRole', 'tlsVersion', 'dtlsCipher', 'srtpCipher'].forEach((k) => (out.transport[k] = transport[k]));
for (const k in inbound) {
out.inbound[k] = pick(inbound[k], ['packetsReceived', 'bytesReceived', 'packetsLost', 'framesReceived', 'framesDecoded', 'keyFramesDecoded', 'pliCount', 'totalSamplesReceived']);
out.inbound[k] = pick(inbound[k], ['packetsReceived', 'bytesReceived', 'packetsLost', 'framesReceived', 'framesDecoded', 'keyFramesDecoded', 'framesDropped', 'frameWidth', 'frameHeight', 'decoderImplementation', 'freezeCount', 'pliCount', 'totalSamplesReceived']);
}
for (const k in outbound) {
out.outbound[k] = pick(outbound[k], ['packetsSent', 'bytesSent', 'framesEncoded', 'keyFramesEncoded', 'pliCount']);
@@ -169,6 +177,7 @@ window.peer = {
async function main() {
const browser = await chromium.launch({
headless: true,
executablePath: process.env.VOELIN_CHROMIUM || undefined,
args: [
// Real host candidates instead of mDNS names (no getUserMedia permission here).
'--disable-features=WebRtcHideLocalIpsWithMdns',
+78
View File
@@ -0,0 +1,78 @@
//! The Node.js side of the browser interop tests (headless Chromium through
//! `tests/interop/browser-peer.cjs`), shared by the tests of several crates
//! with `#[path = ".../tests/interop/browser.rs"] mod browser;`.
use std::path::Path;
use std::process::Stdio;
use std::time::Duration;
use serde_json::{Value, json};
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader, Lines};
use tokio::process::{Child, ChildStdin, ChildStdout, Command};
use tokio::time::timeout;
/// The tests run only with `VOELIN_INTEROP=1` (see `tests/interop/README.md`).
pub fn enabled() -> bool {
std::env::var("VOELIN_INTEROP").is_ok_and(|v| v == "1")
}
/// Headless Chromium, driven over stdin/stdout.
pub struct Browser {
_child: Child,
stdin: ChildStdin,
stdout: Lines<BufReader<ChildStdout>>,
}
impl Browser {
pub async fn start() -> Self {
let script = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../../tests/interop/browser-peer.cjs")
.canonicalize()
.expect("tests/interop/browser-peer.cjs");
let node = std::env::var("VOELIN_NODE").unwrap_or_else(|_| "node".into());
let mut command = Command::new(node);
command
.arg(script)
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::inherit())
.kill_on_drop(true);
// Playwright is usually installed globally.
if std::env::var_os("NODE_PATH").is_none()
&& let Ok(out) = std::process::Command::new("npm").args(["root", "-g"]).output()
{
command.env("NODE_PATH", String::from_utf8_lossy(&out.stdout).trim());
}
let mut child = command.spawn().expect("cannot start node (set VOELIN_NODE)");
let stdin = child.stdin.take().unwrap();
let stdout = BufReader::new(child.stdout.take().unwrap()).lines();
let mut browser = Self { _child: child, stdin, stdout };
let ready = browser.read().await;
eprintln!("browser: {}", ready["userAgent"]);
browser
}
async fn read(&mut self) -> Value {
let line = timeout(Duration::from_secs(60), self.stdout.next_line())
.await
.expect("browser did not answer")
.unwrap()
.expect("browser exited");
let value: Value = serde_json::from_str(&line).unwrap();
if let Some(error) = value.get("error") {
panic!("browser: {error}");
}
value
}
pub async fn call(&mut self, command: Value) -> Value {
let mut line = command.to_string();
line.push('\n');
self.stdin.write_all(line.as_bytes()).await.unwrap();
self.read().await
}
pub async fn quit(mut self) {
let _ = self.call(json!({ "op": "quit" })).await;
}
}