Add native self-hosted instance connection to fluxer_desktop
Trimmed monorepo checkout (fluxer_desktop + packages/voice_engine_v2 + tools/ci) with a "Connect to a Different Server" menu item and popout that lets the desktop app switch to any self-hosted Fluxer instance, plus fixes for well-known discovery on single-domain self-hosted deployments and a false-positive ERR_ABORTED on same-origin client redirects during the switch. Defaults to chat.fluxr.chat and uses an isolated userData directory from the official build.
This commit is contained in:
+763
@@ -0,0 +1,763 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloca"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5a7d05ea6aea7e9e64d25b9156ba2fee3fdd659e34e41063cd2fc7cd020d7f4"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anes"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.20.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
|
||||
|
||||
[[package]]
|
||||
name = "cast"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.63"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "556e016178bb5662a08681bbe0f00f8e17631781a4dfc8c45e466e4b185ec27f"
|
||||
dependencies = [
|
||||
"find-msvc-tools",
|
||||
"shlex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||
|
||||
[[package]]
|
||||
name = "ciborium"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e"
|
||||
dependencies = [
|
||||
"ciborium-io",
|
||||
"ciborium-ll",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ciborium-io"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757"
|
||||
|
||||
[[package]]
|
||||
name = "ciborium-ll"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9"
|
||||
dependencies = [
|
||||
"ciborium-io",
|
||||
"half",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"clap_lex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
|
||||
|
||||
[[package]]
|
||||
name = "criterion"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "950046b2aa2492f9a536f5f4f9a3de7b9e2476e575e05bd6c333371add4d98f3"
|
||||
dependencies = [
|
||||
"alloca",
|
||||
"anes",
|
||||
"cast",
|
||||
"ciborium",
|
||||
"clap",
|
||||
"criterion-plot",
|
||||
"itertools",
|
||||
"num-traits",
|
||||
"oorandom",
|
||||
"page_size",
|
||||
"plotters",
|
||||
"rayon",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tinytemplate",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "criterion-plot"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8d80a2f4f5b554395e47b5d8305bc3d27813bacb73493eb1001e8f76dae29ea"
|
||||
dependencies = [
|
||||
"cast",
|
||||
"itertools",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-deque"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
|
||||
dependencies = [
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
|
||||
dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
||||
|
||||
[[package]]
|
||||
name = "crunchy"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
|
||||
|
||||
[[package]]
|
||||
name = "find-msvc-tools"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
|
||||
|
||||
[[package]]
|
||||
name = "fluxer_audio_mix"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"fluxer_rt_thread",
|
||||
"rtrb",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluxer_rt_thread"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
"pin-project-lite",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "2.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crunchy",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.100"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2025f20d7a4fa7785846e7b63d10a76d3f1cee98ee5cb79ea59703f95e42162"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"futures-util",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.186"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8"
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.21.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
||||
|
||||
[[package]]
|
||||
name = "oorandom"
|
||||
version = "11.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"
|
||||
|
||||
[[package]]
|
||||
name = "page_size"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
|
||||
|
||||
[[package]]
|
||||
name = "plotters"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
"plotters-backend",
|
||||
"plotters-svg",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "plotters-backend"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a"
|
||||
|
||||
[[package]]
|
||||
name = "plotters-svg"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670"
|
||||
dependencies = [
|
||||
"plotters-backend",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
|
||||
dependencies = [
|
||||
"either",
|
||||
"rayon-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon-core"
|
||||
version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
|
||||
dependencies = [
|
||||
"crossbeam-deque",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
|
||||
|
||||
[[package]]
|
||||
name = "rtrb"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ade083ccbb4bf536df69d1f6432cc23deb7acccff86b183f3923a6fd56a1153"
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_core"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.150"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
"serde",
|
||||
"serde_core",
|
||||
"zmij",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.117"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinytemplate"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.123"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a254a4b10c19a76f09a27640e7ffbf9bc30bf67e16a3bf28aaefa4920fe81563"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
"rustversion",
|
||||
"wasm-bindgen-macro",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.123"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24a40fc75b0ec6f3746ceb10d36f53a93dcd68a93b11b6445983945d79eba0dc"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.123"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "908f34bd9b9ce3d4caf07b72dfab63d61504d156856c6bd3cd87fa350cf3985b"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.123"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7acbf7616c27b194bbb550bf77ed0c2c3e5b7fd1260a93082b95fb7f47959b92"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.100"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e0871acf327f283dc6da28a1696cdc64fb355ba9f935d052021fa77f35cce69"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||
dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.62.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
|
||||
dependencies = [
|
||||
"windows-collections",
|
||||
"windows-core",
|
||||
"windows-future",
|
||||
"windows-numerics",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-collections"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
|
||||
dependencies = [
|
||||
"windows-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.62.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
|
||||
dependencies = [
|
||||
"windows-implement",
|
||||
"windows-interface",
|
||||
"windows-link",
|
||||
"windows-result",
|
||||
"windows-strings",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-future"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
|
||||
dependencies = [
|
||||
"windows-core",
|
||||
"windows-link",
|
||||
"windows-threading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.60.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.59.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-numerics"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
|
||||
dependencies = [
|
||||
"windows-core",
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-strings"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.61.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-threading"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b065d4f0e55f82fae73202e189638116a87c55ab6b8e6c2721e13dd9d854ad1"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b631b19d36a892ab55420c92dbc83ccd79274f25be714855d3074aa71cab639"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zmij"
|
||||
version = "1.0.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
|
||||
@@ -0,0 +1,23 @@
|
||||
[package]
|
||||
name = "fluxer_audio_mix"
|
||||
version = "0.0.0"
|
||||
edition = "2024"
|
||||
license = "AGPL-3.0-or-later"
|
||||
publish = false
|
||||
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
|
||||
[lib]
|
||||
crate-type = ["rlib"]
|
||||
|
||||
[dependencies]
|
||||
rtrb = "0.3"
|
||||
fluxer_rt_thread = {path = "../rt-thread"}
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.8"
|
||||
|
||||
[[bench]]
|
||||
name = "mix"
|
||||
harness = false
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"measured_at": "85e057a273fd",
|
||||
"host": "darwin-arm64-apple-silicon",
|
||||
"regression_budget_percent": 5.0,
|
||||
"criterion_args": {
|
||||
"warm_up_time_sec": 2,
|
||||
"measurement_time_sec": 5
|
||||
},
|
||||
"benches": {
|
||||
"audio_mix_tick/mix_8_sources_1024_samples": {
|
||||
"median_ns": 2103.8,
|
||||
"low_ns": 2091.3,
|
||||
"high_ns": 2117.0,
|
||||
"budget_percent_override": 8.0,
|
||||
"note": "Sub-microsecond mix tick; on Apple Silicon with thermal scaling, observed run-to-run sigma is ~3-4%, so 8% leaves room for noise without hiding 1.5x slowdowns."
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
use std::hint::black_box;
|
||||
|
||||
use criterion::{Criterion, criterion_group, criterion_main};
|
||||
use fluxer_audio_mix::{
|
||||
AUDIO_OUTPUT_FRAMES, AudioMixSession, SourceRing, SourceRingConsumer, SourceRingProducer,
|
||||
};
|
||||
use fluxer_rt_thread::TickInfo;
|
||||
|
||||
const BENCH_SOURCE_COUNT: usize = 8;
|
||||
|
||||
fn build_session(source_count: usize) -> (Vec<SourceRingProducer>, AudioMixSession) {
|
||||
assert!(source_count > 0);
|
||||
let mut producers = Vec::with_capacity(source_count);
|
||||
let mut consumers: Vec<SourceRingConsumer> = Vec::with_capacity(source_count);
|
||||
for _ in 0..source_count {
|
||||
let (producer, consumer) = SourceRing::create(8192, 48_000).expect("pair");
|
||||
producers.push(producer);
|
||||
consumers.push(consumer);
|
||||
}
|
||||
let session = AudioMixSession::new(consumers, AUDIO_OUTPUT_FRAMES).expect("session");
|
||||
(producers, session)
|
||||
}
|
||||
|
||||
fn synthetic_tick(index: u64) -> TickInfo {
|
||||
let scheduled_ns = index * 21_333_333;
|
||||
TickInfo {
|
||||
tick_index: index,
|
||||
scheduled_ns,
|
||||
actual_ns: scheduled_ns,
|
||||
lag_ns: 0,
|
||||
}
|
||||
}
|
||||
|
||||
fn fill_producers(producers: &mut [SourceRingProducer], frames: usize) {
|
||||
assert!(!producers.is_empty());
|
||||
assert!(frames > 0);
|
||||
let payload: Vec<i16> = (0..frames).map(|n| ((n as i16) % 4096) - 2048).collect();
|
||||
for producer in producers.iter_mut() {
|
||||
let pushed = producer.try_push_slice(&payload);
|
||||
assert!(pushed > 0);
|
||||
}
|
||||
}
|
||||
|
||||
fn bench_mix_tick(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("audio_mix_tick");
|
||||
group.sample_size(50);
|
||||
group.bench_function("mix_8_sources_1024_samples", |b| {
|
||||
let (mut producers, mut session) = build_session(BENCH_SOURCE_COUNT);
|
||||
let mut tick_index: u64 = 0;
|
||||
b.iter(|| {
|
||||
fill_producers(&mut producers, AUDIO_OUTPUT_FRAMES);
|
||||
let result = session.tick(synthetic_tick(tick_index));
|
||||
tick_index = tick_index.wrapping_add(1);
|
||||
black_box(result);
|
||||
});
|
||||
});
|
||||
group.finish();
|
||||
}
|
||||
|
||||
criterion_group!(benches, bench_mix_tick);
|
||||
criterion_main!(benches);
|
||||
@@ -0,0 +1,57 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
#![deny(clippy::too_many_lines)]
|
||||
|
||||
pub mod mix_session;
|
||||
pub mod source_ring;
|
||||
|
||||
pub use mix_session::{
|
||||
AudioMixSession, MAX_MIX_SOURCES, MixTickResult, MixedFrame, SourceTickStat,
|
||||
};
|
||||
pub use source_ring::{
|
||||
AUDIO_OUTPUT_FRAMES, AUDIO_RING_CAP_FRAMES, AUDIO_SAMPLE_RATE_HZ_MAX, AUDIO_SAMPLE_RATE_HZ_MIN,
|
||||
SourceRing, SourceRingConsumer, SourceRingProducer,
|
||||
};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
pub enum AudioMixError {
|
||||
ZeroCapacity,
|
||||
CapacityExceedsLimit { requested: usize, limit: usize },
|
||||
SampleRateOutOfRange { sample_rate_hz: u32 },
|
||||
SampleRateMismatch { expected_hz: u32, observed_hz: u32 },
|
||||
ZeroSources,
|
||||
TooManySources { requested: usize, limit: usize },
|
||||
MixBufferLenMismatch { expected: usize, observed: usize },
|
||||
}
|
||||
|
||||
impl core::fmt::Display for AudioMixError {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
match self {
|
||||
AudioMixError::ZeroCapacity => write!(f, "ring capacity must be non-zero"),
|
||||
AudioMixError::CapacityExceedsLimit { requested, limit } => {
|
||||
write!(f, "ring capacity {requested} exceeds hard limit {limit}",)
|
||||
}
|
||||
AudioMixError::SampleRateOutOfRange { sample_rate_hz } => {
|
||||
write!(f, "sample rate {sample_rate_hz} hz outside accepted range")
|
||||
}
|
||||
AudioMixError::SampleRateMismatch {
|
||||
expected_hz,
|
||||
observed_hz,
|
||||
} => write!(
|
||||
f,
|
||||
"source sample rate mismatch: expected={expected_hz} observed={observed_hz}",
|
||||
),
|
||||
AudioMixError::ZeroSources => write!(f, "AudioMixSession requires at least one source"),
|
||||
AudioMixError::TooManySources { requested, limit } => write!(
|
||||
f,
|
||||
"AudioMixSession source count {requested} exceeds limit {limit}",
|
||||
),
|
||||
AudioMixError::MixBufferLenMismatch { expected, observed } => write!(
|
||||
f,
|
||||
"mix_buffer_len mismatch: expected={expected} observed={observed}",
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for AudioMixError {}
|
||||
@@ -0,0 +1,411 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
use fluxer_rt_thread::TickInfo;
|
||||
|
||||
use crate::AudioMixError;
|
||||
use crate::source_ring::{AUDIO_OUTPUT_FRAMES, SourceRingConsumer};
|
||||
|
||||
pub const MAX_MIX_SOURCES: usize = 256;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct SourceTickStat {
|
||||
pub drained_count: u32,
|
||||
pub silence_count: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct MixedFrame<'a> {
|
||||
pub samples: &'a [i16; AUDIO_OUTPUT_FRAMES],
|
||||
pub tick_index: u64,
|
||||
pub scheduled_ns: u64,
|
||||
pub actual_ns: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct MixTickResult {
|
||||
pub tick_index: u64,
|
||||
pub scheduled_ns: u64,
|
||||
pub actual_ns: u64,
|
||||
pub lag_ns: i64,
|
||||
pub total_drained: u64,
|
||||
pub total_silence: u64,
|
||||
pub saturated_samples: u32,
|
||||
}
|
||||
|
||||
pub struct AudioMixSession {
|
||||
consumers: Vec<SourceRingConsumer>,
|
||||
per_source_stats: Vec<SourceTickStat>,
|
||||
sample_rate_hz: u32,
|
||||
mix_buffer_len: usize,
|
||||
accumulator: Box<[i32; AUDIO_OUTPUT_FRAMES]>,
|
||||
scratch: Box<[i16; AUDIO_OUTPUT_FRAMES]>,
|
||||
output: Box<[i16; AUDIO_OUTPUT_FRAMES]>,
|
||||
last_tick_index: Option<u64>,
|
||||
last_actual_ns: u64,
|
||||
ticks_completed: u64,
|
||||
}
|
||||
|
||||
impl AudioMixSession {
|
||||
pub fn new(
|
||||
consumers: Vec<SourceRingConsumer>,
|
||||
mix_buffer_len: usize,
|
||||
) -> Result<Self, AudioMixError> {
|
||||
if consumers.is_empty() {
|
||||
return Err(AudioMixError::ZeroSources);
|
||||
}
|
||||
if consumers.len() > MAX_MIX_SOURCES {
|
||||
return Err(AudioMixError::TooManySources {
|
||||
requested: consumers.len(),
|
||||
limit: MAX_MIX_SOURCES,
|
||||
});
|
||||
}
|
||||
if mix_buffer_len != AUDIO_OUTPUT_FRAMES {
|
||||
return Err(AudioMixError::MixBufferLenMismatch {
|
||||
expected: AUDIO_OUTPUT_FRAMES,
|
||||
observed: mix_buffer_len,
|
||||
});
|
||||
}
|
||||
let sample_rate_hz = consumers[0].sample_rate_hz();
|
||||
for consumer in &consumers {
|
||||
let observed = consumer.sample_rate_hz();
|
||||
if observed != sample_rate_hz {
|
||||
return Err(AudioMixError::SampleRateMismatch {
|
||||
expected_hz: sample_rate_hz,
|
||||
observed_hz: observed,
|
||||
});
|
||||
}
|
||||
}
|
||||
assert!(!consumers.is_empty());
|
||||
assert!(consumers.len() <= MAX_MIX_SOURCES);
|
||||
let per_source_stats = vec![
|
||||
SourceTickStat {
|
||||
drained_count: 0,
|
||||
silence_count: 0,
|
||||
};
|
||||
consumers.len()
|
||||
];
|
||||
let accumulator = Box::new([0i32; AUDIO_OUTPUT_FRAMES]);
|
||||
let scratch = Box::new([0i16; AUDIO_OUTPUT_FRAMES]);
|
||||
let output = Box::new([0i16; AUDIO_OUTPUT_FRAMES]);
|
||||
Ok(Self {
|
||||
consumers,
|
||||
per_source_stats,
|
||||
sample_rate_hz,
|
||||
mix_buffer_len,
|
||||
accumulator,
|
||||
scratch,
|
||||
output,
|
||||
last_tick_index: None,
|
||||
last_actual_ns: 0,
|
||||
ticks_completed: 0,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn sample_rate_hz(&self) -> u32 {
|
||||
assert!(self.sample_rate_hz > 0);
|
||||
assert!(self.sample_rate_hz <= 384_000);
|
||||
self.sample_rate_hz
|
||||
}
|
||||
|
||||
pub fn mix_buffer_len(&self) -> usize {
|
||||
assert_eq!(self.mix_buffer_len, AUDIO_OUTPUT_FRAMES);
|
||||
self.mix_buffer_len
|
||||
}
|
||||
|
||||
pub fn source_count(&self) -> usize {
|
||||
assert!(!self.consumers.is_empty());
|
||||
assert!(self.consumers.len() <= MAX_MIX_SOURCES);
|
||||
self.consumers.len()
|
||||
}
|
||||
|
||||
pub fn ticks_completed(&self) -> u64 {
|
||||
self.ticks_completed
|
||||
}
|
||||
|
||||
pub fn per_source_stats(&self) -> &[SourceTickStat] {
|
||||
assert_eq!(self.per_source_stats.len(), self.consumers.len());
|
||||
&self.per_source_stats
|
||||
}
|
||||
|
||||
pub fn tick(&mut self, tick_info: TickInfo) -> MixTickResult {
|
||||
assert!(!self.consumers.is_empty());
|
||||
assert!(tick_info.actual_ns >= self.last_actual_ns);
|
||||
if let Some(prior) = self.last_tick_index {
|
||||
assert!(tick_info.tick_index > prior);
|
||||
}
|
||||
for slot in self.accumulator.iter_mut() {
|
||||
*slot = 0;
|
||||
}
|
||||
let (total_drained, total_silence) = self.mix_all_sources();
|
||||
let saturated = self.finalise_output();
|
||||
self.ticks_completed = self.ticks_completed.saturating_add(1);
|
||||
self.last_tick_index = Some(tick_info.tick_index);
|
||||
self.last_actual_ns = tick_info.actual_ns;
|
||||
let result = MixTickResult {
|
||||
tick_index: tick_info.tick_index,
|
||||
scheduled_ns: tick_info.scheduled_ns,
|
||||
actual_ns: tick_info.actual_ns,
|
||||
lag_ns: tick_info.lag_ns,
|
||||
total_drained,
|
||||
total_silence,
|
||||
saturated_samples: saturated,
|
||||
};
|
||||
assert_eq!(result.tick_index, tick_info.tick_index);
|
||||
assert!(result.saturated_samples as usize <= AUDIO_OUTPUT_FRAMES);
|
||||
result
|
||||
}
|
||||
|
||||
fn mix_all_sources(&mut self) -> (u64, u64) {
|
||||
let n = self.consumers.len();
|
||||
assert_eq!(self.per_source_stats.len(), n);
|
||||
let mut total_drained: u64 = 0;
|
||||
let mut total_silence: u64 = 0;
|
||||
for index in 0..n {
|
||||
let drained = self.consumers[index].drain_into(self.scratch.as_mut_slice());
|
||||
assert!(drained <= AUDIO_OUTPUT_FRAMES);
|
||||
let silence = AUDIO_OUTPUT_FRAMES - drained;
|
||||
let stat = &mut self.per_source_stats[index];
|
||||
stat.drained_count = stat.drained_count.saturating_add(drained as u32);
|
||||
stat.silence_count = stat.silence_count.saturating_add(silence as u32);
|
||||
total_drained = total_drained.saturating_add(drained as u64);
|
||||
total_silence = total_silence.saturating_add(silence as u64);
|
||||
for (acc, sample) in self.accumulator[..drained]
|
||||
.iter_mut()
|
||||
.zip(self.scratch[..drained].iter())
|
||||
{
|
||||
*acc = acc.saturating_add(*sample as i32);
|
||||
}
|
||||
}
|
||||
(total_drained, total_silence)
|
||||
}
|
||||
|
||||
fn finalise_output(&mut self) -> u32 {
|
||||
let mut saturated: u32 = 0;
|
||||
for (out, acc) in self.output.iter_mut().zip(self.accumulator.iter()) {
|
||||
let value = *acc;
|
||||
let clamped = if value > i16::MAX as i32 {
|
||||
saturated = saturated.saturating_add(1);
|
||||
i16::MAX
|
||||
} else if value < i16::MIN as i32 {
|
||||
saturated = saturated.saturating_add(1);
|
||||
i16::MIN
|
||||
} else {
|
||||
value as i16
|
||||
};
|
||||
*out = clamped;
|
||||
}
|
||||
assert!(saturated as usize <= AUDIO_OUTPUT_FRAMES);
|
||||
saturated
|
||||
}
|
||||
|
||||
pub fn last_output(&self) -> &[i16; AUDIO_OUTPUT_FRAMES] {
|
||||
assert_eq!(self.output.len(), AUDIO_OUTPUT_FRAMES);
|
||||
&self.output
|
||||
}
|
||||
|
||||
pub fn last_mixed_frame(&self) -> Option<MixedFrame<'_>> {
|
||||
let tick_index = self.last_tick_index?;
|
||||
assert!(self.ticks_completed > 0);
|
||||
Some(MixedFrame {
|
||||
samples: &self.output,
|
||||
tick_index,
|
||||
scheduled_ns: 0,
|
||||
actual_ns: self.last_actual_ns,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::source_ring::SourceRing;
|
||||
use fluxer_rt_thread::TickInfo;
|
||||
use std::sync::{Arc, Barrier};
|
||||
use std::thread;
|
||||
|
||||
fn synthetic_tick(index: u64) -> TickInfo {
|
||||
let scheduled_ns = index * 21_333_333;
|
||||
TickInfo {
|
||||
tick_index: index,
|
||||
scheduled_ns,
|
||||
actual_ns: scheduled_ns,
|
||||
lag_ns: 0,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_empty_consumer_list() {
|
||||
let err = AudioMixSession::new(Vec::new(), AUDIO_OUTPUT_FRAMES).err();
|
||||
assert_eq!(err, Some(AudioMixError::ZeroSources));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_mismatched_sample_rates() {
|
||||
let (_p1, c1) = SourceRing::create(2048, 48_000).expect("pair 1");
|
||||
let (_p2, c2) = SourceRing::create(2048, 44_100).expect("pair 2");
|
||||
let err = AudioMixSession::new(vec![c1, c2], AUDIO_OUTPUT_FRAMES).err();
|
||||
assert!(matches!(
|
||||
err,
|
||||
Some(AudioMixError::SampleRateMismatch { .. })
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_wrong_mix_buffer_len() {
|
||||
let (_p, c) = SourceRing::create(2048, 48_000).expect("pair");
|
||||
let err = AudioMixSession::new(vec![c], 512).err();
|
||||
assert!(matches!(
|
||||
err,
|
||||
Some(AudioMixError::MixBufferLenMismatch { .. })
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn single_source_passes_through_samples() {
|
||||
let (mut producer, consumer) = SourceRing::create(2048, 48_000).expect("pair");
|
||||
let payload: Vec<i16> = (0..AUDIO_OUTPUT_FRAMES)
|
||||
.map(|n| (n as i16) % 1000)
|
||||
.collect();
|
||||
let pushed = producer.try_push_slice(&payload);
|
||||
assert_eq!(pushed, AUDIO_OUTPUT_FRAMES);
|
||||
let mut session =
|
||||
AudioMixSession::new(vec![consumer], AUDIO_OUTPUT_FRAMES).expect("session");
|
||||
let result = session.tick(synthetic_tick(0));
|
||||
assert_eq!(result.total_drained, AUDIO_OUTPUT_FRAMES as u64);
|
||||
assert_eq!(result.total_silence, 0);
|
||||
assert_eq!(&session.last_output()[..], &payload[..]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_ring_produces_silence_without_blocking() {
|
||||
let (_producer, consumer) = SourceRing::create(2048, 48_000).expect("pair");
|
||||
let mut session =
|
||||
AudioMixSession::new(vec![consumer], AUDIO_OUTPUT_FRAMES).expect("session");
|
||||
let result = session.tick(synthetic_tick(0));
|
||||
assert_eq!(result.total_drained, 0);
|
||||
assert_eq!(result.total_silence, AUDIO_OUTPUT_FRAMES as u64);
|
||||
for sample in session.last_output().iter() {
|
||||
assert_eq!(*sample, 0);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn drained_count_accuracy_across_partial_fills() {
|
||||
let (mut producer, consumer) = SourceRing::create(2048, 48_000).expect("pair");
|
||||
let half: Vec<i16> = vec![100; AUDIO_OUTPUT_FRAMES / 2];
|
||||
producer.try_push_slice(&half);
|
||||
let mut session =
|
||||
AudioMixSession::new(vec![consumer], AUDIO_OUTPUT_FRAMES).expect("session");
|
||||
let result = session.tick(synthetic_tick(0));
|
||||
assert_eq!(result.total_drained, (AUDIO_OUTPUT_FRAMES / 2) as u64);
|
||||
assert_eq!(result.total_silence, (AUDIO_OUTPUT_FRAMES / 2) as u64);
|
||||
let stats = session.per_source_stats();
|
||||
assert_eq!(stats.len(), 1);
|
||||
assert_eq!(stats[0].drained_count as usize, AUDIO_OUTPUT_FRAMES / 2);
|
||||
assert_eq!(stats[0].silence_count as usize, AUDIO_OUTPUT_FRAMES / 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn opposite_phase_sources_sum_to_silence() {
|
||||
let (mut p1, c1) = SourceRing::create(2048, 48_000).expect("pair 1");
|
||||
let (mut p2, c2) = SourceRing::create(2048, 48_000).expect("pair 2");
|
||||
let wave: Vec<i16> = (0..AUDIO_OUTPUT_FRAMES)
|
||||
.map(|n| ((n as i16) % 1000) - 500)
|
||||
.collect();
|
||||
let inverse: Vec<i16> = wave.iter().map(|s| -*s).collect();
|
||||
p1.try_push_slice(&wave);
|
||||
p2.try_push_slice(&inverse);
|
||||
let mut session = AudioMixSession::new(vec![c1, c2], AUDIO_OUTPUT_FRAMES).expect("session");
|
||||
let _ = session.tick(synthetic_tick(0));
|
||||
for sample in session.last_output().iter() {
|
||||
assert_eq!(*sample, 0);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn saturation_clamps_at_i16_limits() {
|
||||
let (mut p1, c1) = SourceRing::create(2048, 48_000).expect("pair 1");
|
||||
let (mut p2, c2) = SourceRing::create(2048, 48_000).expect("pair 2");
|
||||
let high: Vec<i16> = vec![i16::MAX; AUDIO_OUTPUT_FRAMES];
|
||||
p1.try_push_slice(&high);
|
||||
p2.try_push_slice(&high);
|
||||
let mut session = AudioMixSession::new(vec![c1, c2], AUDIO_OUTPUT_FRAMES).expect("session");
|
||||
let result = session.tick(synthetic_tick(0));
|
||||
assert_eq!(result.saturated_samples as usize, AUDIO_OUTPUT_FRAMES);
|
||||
for sample in session.last_output().iter() {
|
||||
assert_eq!(*sample, i16::MAX);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn saturation_clamps_at_i16_min_limits() {
|
||||
let (mut p1, c1) = SourceRing::create(2048, 48_000).expect("pair 1");
|
||||
let (mut p2, c2) = SourceRing::create(2048, 48_000).expect("pair 2");
|
||||
let low: Vec<i16> = vec![i16::MIN; AUDIO_OUTPUT_FRAMES];
|
||||
p1.try_push_slice(&low);
|
||||
p2.try_push_slice(&low);
|
||||
let mut session = AudioMixSession::new(vec![c1, c2], AUDIO_OUTPUT_FRAMES).expect("session");
|
||||
let result = session.tick(synthetic_tick(0));
|
||||
assert_eq!(result.saturated_samples as usize, AUDIO_OUTPUT_FRAMES);
|
||||
for sample in session.last_output().iter() {
|
||||
assert_eq!(*sample, i16::MIN);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn full_ring_producer_drops_overflow() {
|
||||
let (mut producer, consumer) =
|
||||
SourceRing::create(AUDIO_OUTPUT_FRAMES, 48_000).expect("pair");
|
||||
let payload: Vec<i16> = vec![7; AUDIO_OUTPUT_FRAMES];
|
||||
let pushed_first = producer.try_push_slice(&payload);
|
||||
assert_eq!(pushed_first, AUDIO_OUTPUT_FRAMES);
|
||||
let pushed_second = producer.try_push_slice(&payload);
|
||||
assert_eq!(pushed_second, 0);
|
||||
assert_eq!(producer.dropped_total(), AUDIO_OUTPUT_FRAMES as u64);
|
||||
let mut session =
|
||||
AudioMixSession::new(vec![consumer], AUDIO_OUTPUT_FRAMES).expect("session");
|
||||
let result = session.tick(synthetic_tick(0));
|
||||
assert_eq!(result.total_drained, AUDIO_OUTPUT_FRAMES as u64);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ten_producer_threads_one_mixer_no_panic() {
|
||||
const SOURCE_COUNT: usize = 10;
|
||||
const TICKS: u64 = 50;
|
||||
let mut producers = Vec::with_capacity(SOURCE_COUNT);
|
||||
let mut consumers = Vec::with_capacity(SOURCE_COUNT);
|
||||
for _ in 0..SOURCE_COUNT {
|
||||
let (producer, consumer) = SourceRing::create(8192, 48_000).expect("pair");
|
||||
producers.push(producer);
|
||||
consumers.push(consumer);
|
||||
}
|
||||
let barrier = Arc::new(Barrier::new(SOURCE_COUNT + 1));
|
||||
let stop = Arc::new(std::sync::atomic::AtomicBool::new(false));
|
||||
let mut handles = Vec::with_capacity(SOURCE_COUNT);
|
||||
for (index, mut producer) in producers.into_iter().enumerate() {
|
||||
let barrier = Arc::clone(&barrier);
|
||||
let stop = Arc::clone(&stop);
|
||||
handles.push(thread::spawn(move || {
|
||||
barrier.wait();
|
||||
let mut value: i16 = index as i16;
|
||||
while !stop.load(std::sync::atomic::Ordering::Acquire) {
|
||||
let _ = producer.try_push(value);
|
||||
value = value.wrapping_add(1);
|
||||
}
|
||||
}));
|
||||
}
|
||||
let mut session = AudioMixSession::new(consumers, AUDIO_OUTPUT_FRAMES).expect("session");
|
||||
barrier.wait();
|
||||
let mut last_drained: u64 = 0;
|
||||
for tick_index in 0..TICKS {
|
||||
let result = session.tick(synthetic_tick(tick_index));
|
||||
last_drained = last_drained.saturating_add(result.total_drained);
|
||||
}
|
||||
stop.store(true, std::sync::atomic::Ordering::Release);
|
||||
for handle in handles {
|
||||
handle.join().expect("producer join");
|
||||
}
|
||||
assert_eq!(session.ticks_completed(), TICKS);
|
||||
assert!(last_drained > 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
use rtrb::{Consumer, Producer, RingBuffer};
|
||||
|
||||
use crate::AudioMixError;
|
||||
|
||||
pub const AUDIO_RING_CAP_FRAMES: usize = 4096;
|
||||
|
||||
pub const AUDIO_RING_CAP_FRAMES_MAX: usize = 1 << 20;
|
||||
|
||||
pub const AUDIO_OUTPUT_FRAMES: usize = 1024;
|
||||
|
||||
pub const AUDIO_SAMPLE_RATE_HZ_MIN: u32 = 8_000;
|
||||
pub const AUDIO_SAMPLE_RATE_HZ_MAX: u32 = 384_000;
|
||||
|
||||
pub struct SourceRingProducer {
|
||||
inner: Producer<i16>,
|
||||
sample_rate_hz: u32,
|
||||
capacity_frames: usize,
|
||||
pushed_total: u64,
|
||||
dropped_total: u64,
|
||||
}
|
||||
|
||||
pub struct SourceRingConsumer {
|
||||
inner: Consumer<i16>,
|
||||
sample_rate_hz: u32,
|
||||
capacity_frames: usize,
|
||||
drained_total: u64,
|
||||
}
|
||||
|
||||
pub struct SourceRing;
|
||||
|
||||
impl SourceRing {
|
||||
pub fn create(
|
||||
capacity_frames: usize,
|
||||
sample_rate_hz: u32,
|
||||
) -> Result<(SourceRingProducer, SourceRingConsumer), AudioMixError> {
|
||||
if capacity_frames == 0 {
|
||||
return Err(AudioMixError::ZeroCapacity);
|
||||
}
|
||||
if capacity_frames > AUDIO_RING_CAP_FRAMES_MAX {
|
||||
return Err(AudioMixError::CapacityExceedsLimit {
|
||||
requested: capacity_frames,
|
||||
limit: AUDIO_RING_CAP_FRAMES_MAX,
|
||||
});
|
||||
}
|
||||
if !(AUDIO_SAMPLE_RATE_HZ_MIN..=AUDIO_SAMPLE_RATE_HZ_MAX).contains(&sample_rate_hz) {
|
||||
return Err(AudioMixError::SampleRateOutOfRange { sample_rate_hz });
|
||||
}
|
||||
assert!(capacity_frames > 0);
|
||||
assert!(capacity_frames <= AUDIO_RING_CAP_FRAMES_MAX);
|
||||
let (producer, consumer) = RingBuffer::<i16>::new(capacity_frames);
|
||||
let producer = SourceRingProducer {
|
||||
inner: producer,
|
||||
sample_rate_hz,
|
||||
capacity_frames,
|
||||
pushed_total: 0,
|
||||
dropped_total: 0,
|
||||
};
|
||||
let consumer = SourceRingConsumer {
|
||||
inner: consumer,
|
||||
sample_rate_hz,
|
||||
capacity_frames,
|
||||
drained_total: 0,
|
||||
};
|
||||
assert_eq!(producer.sample_rate_hz, consumer.sample_rate_hz);
|
||||
assert_eq!(producer.capacity_frames, consumer.capacity_frames);
|
||||
Ok((producer, consumer))
|
||||
}
|
||||
|
||||
pub fn create_default(
|
||||
sample_rate_hz: u32,
|
||||
) -> Result<(SourceRingProducer, SourceRingConsumer), AudioMixError> {
|
||||
const { assert!(AUDIO_RING_CAP_FRAMES > 0) };
|
||||
const { assert!(AUDIO_RING_CAP_FRAMES <= AUDIO_RING_CAP_FRAMES_MAX) };
|
||||
SourceRing::create(AUDIO_RING_CAP_FRAMES, sample_rate_hz)
|
||||
}
|
||||
}
|
||||
|
||||
impl SourceRingProducer {
|
||||
pub fn sample_rate_hz(&self) -> u32 {
|
||||
assert!(self.sample_rate_hz >= AUDIO_SAMPLE_RATE_HZ_MIN);
|
||||
assert!(self.sample_rate_hz <= AUDIO_SAMPLE_RATE_HZ_MAX);
|
||||
self.sample_rate_hz
|
||||
}
|
||||
|
||||
pub fn capacity_frames(&self) -> usize {
|
||||
assert!(self.capacity_frames > 0);
|
||||
assert!(self.capacity_frames <= AUDIO_RING_CAP_FRAMES_MAX);
|
||||
self.capacity_frames
|
||||
}
|
||||
|
||||
pub fn slots(&self) -> usize {
|
||||
let slots = self.inner.slots();
|
||||
assert!(slots <= self.capacity_frames);
|
||||
slots
|
||||
}
|
||||
|
||||
pub fn is_full(&self) -> bool {
|
||||
self.inner.is_full()
|
||||
}
|
||||
|
||||
pub fn try_push(&mut self, sample: i16) -> bool {
|
||||
assert!(self.capacity_frames > 0);
|
||||
assert!(self.pushed_total < u64::MAX);
|
||||
match self.inner.push(sample) {
|
||||
Ok(()) => {
|
||||
self.pushed_total = self.pushed_total.saturating_add(1);
|
||||
true
|
||||
}
|
||||
Err(_) => {
|
||||
self.dropped_total = self.dropped_total.saturating_add(1);
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn try_push_slice(&mut self, samples: &[i16]) -> usize {
|
||||
assert!(samples.len() <= self.capacity_frames);
|
||||
assert!(self.pushed_total < u64::MAX - samples.len() as u64);
|
||||
let (pushed_slice, remainder) = self.inner.push_partial_slice(samples);
|
||||
let pushed = pushed_slice.len();
|
||||
let dropped = remainder.len();
|
||||
assert_eq!(pushed + dropped, samples.len());
|
||||
self.pushed_total = self.pushed_total.saturating_add(pushed as u64);
|
||||
self.dropped_total = self.dropped_total.saturating_add(dropped as u64);
|
||||
pushed
|
||||
}
|
||||
|
||||
pub fn pushed_total(&self) -> u64 {
|
||||
self.pushed_total
|
||||
}
|
||||
|
||||
pub fn dropped_total(&self) -> u64 {
|
||||
self.dropped_total
|
||||
}
|
||||
}
|
||||
|
||||
impl SourceRingConsumer {
|
||||
pub fn sample_rate_hz(&self) -> u32 {
|
||||
assert!(self.sample_rate_hz >= AUDIO_SAMPLE_RATE_HZ_MIN);
|
||||
assert!(self.sample_rate_hz <= AUDIO_SAMPLE_RATE_HZ_MAX);
|
||||
self.sample_rate_hz
|
||||
}
|
||||
|
||||
pub fn capacity_frames(&self) -> usize {
|
||||
assert!(self.capacity_frames > 0);
|
||||
assert!(self.capacity_frames <= AUDIO_RING_CAP_FRAMES_MAX);
|
||||
self.capacity_frames
|
||||
}
|
||||
|
||||
pub fn slots(&self) -> usize {
|
||||
let slots = self.inner.slots();
|
||||
assert!(slots <= self.capacity_frames);
|
||||
slots
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.inner.is_empty()
|
||||
}
|
||||
|
||||
pub fn drain_into(&mut self, dest: &mut [i16]) -> usize {
|
||||
assert!(!dest.is_empty());
|
||||
assert!(dest.len() <= self.capacity_frames);
|
||||
let requested = dest.len();
|
||||
let (popped, remainder) = self.inner.pop_partial_slice(dest);
|
||||
let drained = popped.len();
|
||||
let leftover = remainder.len();
|
||||
assert_eq!(drained + leftover, requested);
|
||||
self.drained_total = self.drained_total.saturating_add(drained as u64);
|
||||
drained
|
||||
}
|
||||
|
||||
pub fn drained_total(&self) -> u64 {
|
||||
self.drained_total
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn rejects_zero_capacity() {
|
||||
let err = SourceRing::create(0, 48_000).err();
|
||||
assert_eq!(err, Some(AudioMixError::ZeroCapacity));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_capacity_over_limit() {
|
||||
let err = SourceRing::create(AUDIO_RING_CAP_FRAMES_MAX + 1, 48_000).err();
|
||||
assert!(matches!(
|
||||
err,
|
||||
Some(AudioMixError::CapacityExceedsLimit { .. })
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_sample_rate_below_min() {
|
||||
let err = SourceRing::create(AUDIO_RING_CAP_FRAMES, 4_000).err();
|
||||
assert!(matches!(
|
||||
err,
|
||||
Some(AudioMixError::SampleRateOutOfRange { .. })
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_sample_rate_above_max() {
|
||||
let err = SourceRing::create(AUDIO_RING_CAP_FRAMES, 500_000).err();
|
||||
assert!(matches!(
|
||||
err,
|
||||
Some(AudioMixError::SampleRateOutOfRange { .. })
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn default_capacity_pair_matches() {
|
||||
let (producer, consumer) = SourceRing::create_default(48_000).expect("pair");
|
||||
assert_eq!(producer.sample_rate_hz(), 48_000);
|
||||
assert_eq!(consumer.sample_rate_hz(), 48_000);
|
||||
assert_eq!(producer.capacity_frames(), AUDIO_RING_CAP_FRAMES);
|
||||
assert_eq!(consumer.capacity_frames(), AUDIO_RING_CAP_FRAMES);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn push_then_drain_roundtrips() {
|
||||
let (mut producer, mut consumer) = SourceRing::create(64, 48_000).expect("pair");
|
||||
let samples: Vec<i16> = (0..32).map(|n| n as i16).collect();
|
||||
let pushed = producer.try_push_slice(&samples);
|
||||
assert_eq!(pushed, 32);
|
||||
let mut buf = [0i16; 32];
|
||||
let drained = consumer.drain_into(&mut buf);
|
||||
assert_eq!(drained, 32);
|
||||
assert_eq!(&buf[..], &samples[..]);
|
||||
assert_eq!(producer.pushed_total(), 32);
|
||||
assert_eq!(consumer.drained_total(), 32);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn try_push_returns_false_when_full_and_increments_dropped() {
|
||||
let (mut producer, _consumer) = SourceRing::create(2, 48_000).expect("pair");
|
||||
assert!(producer.try_push(1));
|
||||
assert!(producer.try_push(2));
|
||||
assert!(!producer.try_push(3));
|
||||
assert!(producer.is_full());
|
||||
assert_eq!(producer.dropped_total(), 1);
|
||||
assert_eq!(producer.pushed_total(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn try_push_slice_partial_when_capacity_runs_out() {
|
||||
let (mut producer, _consumer) = SourceRing::create(4, 48_000).expect("pair");
|
||||
let pushed = producer.try_push_slice(&[10, 20, 30, 40]);
|
||||
assert_eq!(pushed, 4);
|
||||
let pushed_again = producer.try_push_slice(&[50, 60]);
|
||||
assert_eq!(pushed_again, 0);
|
||||
assert_eq!(producer.dropped_total(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn drain_into_handles_empty_ring() {
|
||||
let (_producer, mut consumer) = SourceRing::create(64, 48_000).expect("pair");
|
||||
let mut buf = [0i16; 16];
|
||||
let drained = consumer.drain_into(&mut buf);
|
||||
assert_eq!(drained, 0);
|
||||
assert!(consumer.is_empty());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user