зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1893488 - mach vendor rust. r=cubeb-reviewers,pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D208644
This commit is contained in:
Родитель
70d66654ff
Коммит
a9d5a5c23e
|
@ -70,9 +70,9 @@ git = "https://github.com/mozilla/audioipc"
|
|||
rev = "409e11f8de6288e9ddfe269654523735302e59e6"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=cc58f92f28015e4e25eba9e482007cf464c10474"]
|
||||
[source."git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=4ca174cf83ebe32b3198478c2211d69678845bc7"]
|
||||
git = "https://github.com/mozilla/cubeb-coreaudio-rs"
|
||||
rev = "cc58f92f28015e4e25eba9e482007cf464c10474"
|
||||
rev = "4ca174cf83ebe32b3198478c2211d69678845bc7"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source."git+https://github.com/mozilla/cubeb-pulse-rs?rev=8ff972c8e2ec1782ff262ac4071c0415e69b1367"]
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.lock":"ac8d6a7af46ee8f72d22abb80575109b75bcb2a20ea6cacb6626a20f337fe51f","Cargo.toml":"9316753099606b9531ea52aec87270a83e74c15b6563f8f979b0e961e0cf73fd","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"e2e6b7d80550743e01faa26c19f6c8520fd0dc5db68021c042fd523eed46c799","benches/benchmark.rs":"33e9d85cee38fb7752e9315ccf5f816179309062bfb78118288f7e1495e3616f","install_rustfmt_clippy.sh":"4ae90d8dcb9757cb3ae4ae142ef80e5377c0dde61c63f4a3c32418646e80ca7b","run_sanitizers.sh":"e31b4a11559b52043920c63e6ad4e57051d6205883ecf2b2c48e105ba522015b","run_tests.sh":"21ca30cb6d41c6b35e6207e3283292933ef6628575dd587287fad6db2afb22bd","src/channel.rs":"d948d890219b810632277d2b04297334a47dc6639ef93309e74495ff408f82b6","src/coefficient.rs":"24f56281a1b800769feefc735d77c2ec03f1aa8d7c58c256b25ce1a9053a06cc","src/lib.rs":"f0ee59ac224ce6ba0cc6cb9e1796e85b9b751ba4d92c58fe3fb8b10c95b72cc4","src/main.rs":"b5ba05638c727040581c49ffd2d784493af658495cd424ce8c9365f779994baf"},"package":"c41dc008c1973ce58ff3cfc52df53814a9b7b78d73d95b071b5ff0ed4b2db3e1"}
|
||||
{"files":{"Cargo.lock":"819b29d15e418e551415a161f56eee3d2848f4e2e0936a4d8f3d4be11d2ef598","Cargo.toml":"b3de055f40a2d1895630310c8b41d7dd86fcd99b5c719f625e5ddaa9c2a3775d","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"e2e6b7d80550743e01faa26c19f6c8520fd0dc5db68021c042fd523eed46c799","benches/benchmark.rs":"33e9d85cee38fb7752e9315ccf5f816179309062bfb78118288f7e1495e3616f","install_rustfmt_clippy.sh":"4ae90d8dcb9757cb3ae4ae142ef80e5377c0dde61c63f4a3c32418646e80ca7b","run_sanitizers.sh":"e31b4a11559b52043920c63e6ad4e57051d6205883ecf2b2c48e105ba522015b","run_tests.sh":"21ca30cb6d41c6b35e6207e3283292933ef6628575dd587287fad6db2afb22bd","src/channel.rs":"243a51c37d07755b67bcce54ca2a27e0f3099b4ea510a7b7e60c4b3f17402167","src/coefficient.rs":"64a6cda5fc8630f033c80717616183f6e172da5fd2d338028e52f77d8b7e0830","src/lib.rs":"f0ee59ac224ce6ba0cc6cb9e1796e85b9b751ba4d92c58fe3fb8b10c95b72cc4","src/main.rs":"b5ba05638c727040581c49ffd2d784493af658495cd424ce8c9365f779994baf"},"package":"4f1245ab2f85c284bac1ac1f03565539644566295ef6eb9c4eae42e9a40c51b2"}
|
|
@ -4,9 +4,9 @@ version = 3
|
|||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.0"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f2135563fb5c609d2b2b87c1e8ce7bc41b0b45430fa9661f457981503dd5bf0"
|
||||
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
@ -17,14 +17,14 @@ version = "0.2.14"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||
dependencies = [
|
||||
"hermit-abi 0.1.19",
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "audio-mixer"
|
||||
version = "0.1.3"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"criterion",
|
||||
|
@ -33,9 +33,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
|
@ -45,9 +45,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.14.0"
|
||||
version = "3.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
|
||||
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
|
||||
|
||||
[[package]]
|
||||
name = "cast"
|
||||
|
@ -108,54 +108,36 @@ dependencies = [
|
|||
"itertools",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.5.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-deque"
|
||||
version = "0.8.3"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
|
||||
checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.15"
|
||||
version = "0.9.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
|
||||
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
"memoffset",
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.16"
|
||||
version = "0.8.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
|
||||
|
||||
[[package]]
|
||||
name = "csv"
|
||||
version = "1.2.2"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "626ae34994d3d8d668f4269922248239db4ae42d538b14c398b74a52208e8086"
|
||||
checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe"
|
||||
dependencies = [
|
||||
"csv-core",
|
||||
"itoa",
|
||||
|
@ -165,18 +147,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "csv-core"
|
||||
version = "0.1.10"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90"
|
||||
checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.9.0"
|
||||
version = "1.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
||||
checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2"
|
||||
|
||||
[[package]]
|
||||
name = "float-cmp"
|
||||
|
@ -189,9 +171,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "1.8.2"
|
||||
version = "1.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
|
||||
checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
|
@ -202,12 +184,6 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.10.5"
|
||||
|
@ -219,15 +195,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.9"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
||||
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.64"
|
||||
version = "0.3.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
|
||||
checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
@ -240,55 +216,36 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.148"
|
||||
version = "0.2.153"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b"
|
||||
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.20"
|
||||
version = "0.4.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.6.3"
|
||||
version = "2.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c"
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.16"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2"
|
||||
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
|
||||
dependencies = [
|
||||
"hermit-abi 0.3.2",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.18.0"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
|
||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||
|
||||
[[package]]
|
||||
name = "oorandom"
|
||||
|
@ -326,27 +283,27 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.67"
|
||||
version = "1.0.80"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328"
|
||||
checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.33"
|
||||
version = "1.0.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
|
||||
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.7.0"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b"
|
||||
checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
|
||||
dependencies = [
|
||||
"either",
|
||||
"rayon-core",
|
||||
|
@ -354,21 +311,19 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rayon-core"
|
||||
version = "1.11.0"
|
||||
version = "1.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d"
|
||||
checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
|
||||
dependencies = [
|
||||
"crossbeam-channel",
|
||||
"crossbeam-deque",
|
||||
"crossbeam-utils",
|
||||
"num_cpus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.9.5"
|
||||
version = "1.10.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47"
|
||||
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
|
@ -378,9 +333,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.3.8"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795"
|
||||
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
|
@ -389,15 +344,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.7.5"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
|
||||
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.15"
|
||||
version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
|
||||
checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
|
@ -408,17 +363,11 @@ dependencies = [
|
|||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.188"
|
||||
version = "1.0.197"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e"
|
||||
checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
@ -435,9 +384,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.188"
|
||||
version = "1.0.197"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
|
||||
checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -446,9 +395,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.107"
|
||||
version = "1.0.116"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65"
|
||||
checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
|
@ -457,9 +406,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.37"
|
||||
version = "2.0.59"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8"
|
||||
checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -493,15 +442,15 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
|||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.10"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
||||
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.4.0"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee"
|
||||
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi-util",
|
||||
|
@ -509,9 +458,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.87"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
|
||||
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
|
@ -519,9 +468,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.87"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
|
||||
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
|
@ -534,9 +483,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.87"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
|
||||
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
|
@ -544,9 +493,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.87"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
|
||||
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -557,15 +506,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.87"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
|
||||
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.64"
|
||||
version = "0.3.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
|
||||
checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
|
@ -589,9 +538,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
|||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
|
||||
checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
[package]
|
||||
edition = "2018"
|
||||
name = "audio-mixer"
|
||||
version = "0.1.3"
|
||||
version = "0.2.0"
|
||||
authors = ["Chun-Min Chang <chun.m.chang@gmail.com>"]
|
||||
description = "Mixing audio by the input and output channel layout"
|
||||
readme = "README.md"
|
||||
|
|
|
@ -21,6 +21,7 @@ pub enum Channel {
|
|||
TopBackCenter = 16,
|
||||
TopBackRight = 17,
|
||||
Silence = 18,
|
||||
Discrete = 19, // To be used based on its index
|
||||
}
|
||||
|
||||
impl Channel {
|
||||
|
@ -29,7 +30,7 @@ impl Channel {
|
|||
}
|
||||
|
||||
pub const fn count() -> usize {
|
||||
Channel::Silence as usize + 1
|
||||
Channel::Discrete as usize + 1
|
||||
}
|
||||
|
||||
pub const fn bitmask(self) -> u32 {
|
||||
|
@ -58,6 +59,7 @@ bitflags! {
|
|||
const TOP_BACK_CENTER = Channel::TopBackCenter.bitmask();
|
||||
const TOP_BACK_RIGHT = Channel::TopBackRight.bitmask();
|
||||
const SILENCE = Channel::Silence.bitmask();
|
||||
const DISCRETE = Channel::Discrete.bitmask();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ const CHANNELS: usize = Channel::count();
|
|||
|
||||
#[derive(Debug)]
|
||||
enum Error {
|
||||
DuplicateNonSilenceChannel,
|
||||
DuplicateChannel,
|
||||
AsymmetricChannels,
|
||||
}
|
||||
|
||||
|
@ -28,13 +28,15 @@ impl ChannelLayout {
|
|||
})
|
||||
}
|
||||
|
||||
// Except Silence channel, the duplicate channels are not allowed.
|
||||
// Except Silence and Discrete channels, duplicate channels aren't allowed.
|
||||
fn get_channel_map(channels: &[Channel]) -> Result<ChannelMap, Error> {
|
||||
let mut map = ChannelMap::empty();
|
||||
for channel in channels {
|
||||
let bitmask = ChannelMap::from(*channel);
|
||||
if channel != &Channel::Silence && map.contains(bitmask) {
|
||||
return Err(Error::DuplicateNonSilenceChannel);
|
||||
if (channel != &Channel::Silence && channel != &Channel::Discrete)
|
||||
&& map.contains(bitmask)
|
||||
{
|
||||
return Err(Error::DuplicateChannel);
|
||||
}
|
||||
map.insert(bitmask);
|
||||
}
|
||||
|
@ -83,15 +85,41 @@ where
|
|||
let input_layout = ChannelLayout::new(input_channels).expect("Invalid input layout");
|
||||
let output_layout = ChannelLayout::new(output_channels).expect("Invalid output layout");
|
||||
|
||||
let mixing_matrix =
|
||||
Self::build_mixing_matrix(input_layout.channel_map, output_layout.channel_map)
|
||||
.unwrap_or_else(|_| Self::get_basic_matrix());
|
||||
|
||||
let coefficient_matrix = Self::pick_coefficients(
|
||||
&input_layout.channels,
|
||||
&output_layout.channels,
|
||||
&mixing_matrix,
|
||||
);
|
||||
// Check if this is a professional audio interface rather than a sound card for playback, in
|
||||
// which case it is expected to simply pass all the channel through without change.
|
||||
// Those interfaces only have an explicit mapping for the stereo pair, but have lots of channels.
|
||||
let mut only_stereo_or_discrete = true;
|
||||
for channel in output_channels {
|
||||
if *channel != Channel::Discrete
|
||||
&& *channel != Channel::FrontLeft
|
||||
&& *channel != Channel::FrontRight
|
||||
{
|
||||
only_stereo_or_discrete = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
let coefficient_matrix = if only_stereo_or_discrete && output_channels.len() > 2 {
|
||||
let mut matrix = Vec::with_capacity(output_channels.len());
|
||||
// Create a diagonal line of 1.0 for input channels
|
||||
for (output_channel_index, _) in output_channels.iter().enumerate() {
|
||||
let mut coefficients = Vec::with_capacity(input_channels.len());
|
||||
coefficients.resize(input_channels.len(), 0.0);
|
||||
if output_channel_index < coefficients.len() {
|
||||
coefficients[output_channel_index] = 1.0;
|
||||
}
|
||||
matrix.push(coefficients);
|
||||
}
|
||||
matrix
|
||||
} else {
|
||||
let mixing_matrix =
|
||||
Self::build_mixing_matrix(input_layout.channel_map, output_layout.channel_map)
|
||||
.unwrap_or_else(|_| Self::get_basic_matrix());
|
||||
Self::pick_coefficients(
|
||||
&input_layout.channels,
|
||||
&output_layout.channels,
|
||||
&mixing_matrix,
|
||||
)
|
||||
};
|
||||
|
||||
let normalized_matrix = Self::normalize(T::max_coefficients_sum(), coefficient_matrix);
|
||||
|
||||
|
@ -430,7 +458,7 @@ impl MixingCoefficient for f32 {
|
|||
type Coef = f32;
|
||||
|
||||
fn max_coefficients_sum() -> f64 {
|
||||
f64::from(std::i32::MAX)
|
||||
f64::from(i32::MAX)
|
||||
}
|
||||
|
||||
fn coefficient_from_f64(value: f64) -> Self::Coef {
|
||||
|
@ -550,12 +578,12 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn test_create_with_duplicate_silience_channels_f32() {
|
||||
test_create_with_duplicate_silience_channels::<f32>()
|
||||
test_create_with_duplicate_channels::<f32>()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_create_with_duplicate_silience_channels_i16() {
|
||||
test_create_with_duplicate_silience_channels::<i16>()
|
||||
test_create_with_duplicate_channels::<i16>()
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -582,7 +610,7 @@ mod test {
|
|||
test_create_with_duplicate_output_channels::<i16>()
|
||||
}
|
||||
|
||||
fn test_create_with_duplicate_silience_channels<T>()
|
||||
fn test_create_with_duplicate_channels<T>()
|
||||
where
|
||||
T: MixingCoefficient,
|
||||
T::Coef: Copy,
|
||||
|
@ -649,78 +677,155 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_redirect_matrix_f32() {
|
||||
test_get_redirect_matrix::<f32>();
|
||||
fn test_get_discrete_mapping() {
|
||||
test_get_discrete_mapping_matrix::<f32>();
|
||||
test_get_discrete_mapping_matrix::<i16>();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_redirect_matrix_i16() {
|
||||
test_get_redirect_matrix::<i16>();
|
||||
fn test_get_discrete_mapping_too_many_channels() {
|
||||
test_get_discrete_mapping_matrix_too_many_channels::<i16>();
|
||||
test_get_discrete_mapping_matrix_too_many_channels::<f32>();
|
||||
}
|
||||
|
||||
fn test_get_redirect_matrix<T>()
|
||||
#[test]
|
||||
fn test_get_regular_mapping_too_many_channels() {
|
||||
test_get_regular_mapping_matrix_too_many_channels::<i16>();
|
||||
test_get_regular_mapping_matrix_too_many_channels::<f32>();
|
||||
}
|
||||
|
||||
// Check that a matrix is diagonal (1.0 on the diagnoal, 0.0 elsewhere). It's valid to have more input or output channels
|
||||
fn assert_is_diagonal<T>(
|
||||
coefficients: &Coefficient<T>,
|
||||
input_channels: usize,
|
||||
output_channels: usize,
|
||||
) where
|
||||
T: MixingCoefficient,
|
||||
T::Coef: Copy + Debug + PartialEq,
|
||||
{
|
||||
for i in 0..input_channels {
|
||||
for j in 0..output_channels {
|
||||
if i == j {
|
||||
assert_eq!(coefficients.get(i, j), T::coefficient_from_f64(1.0));
|
||||
} else {
|
||||
assert_eq!(coefficients.get(i, j), T::coefficient_from_f64(0.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
println!(
|
||||
"{:?} = {:?} * {:?}",
|
||||
output_channels, coefficients.matrix, input_channels
|
||||
);
|
||||
}
|
||||
|
||||
fn test_get_discrete_mapping_matrix<T>()
|
||||
where
|
||||
T: MixingCoefficient,
|
||||
T::Coef: Copy + Debug + PartialEq,
|
||||
{
|
||||
// Create a matrix that only redirect the channels from input side to output side,
|
||||
// without mixing input audio data to output audio data.
|
||||
fn compute_redirect_matrix<T>(
|
||||
input_channels: &[Channel],
|
||||
output_channels: &[Channel],
|
||||
) -> Vec<Vec<T::Coef>>
|
||||
where
|
||||
T: MixingCoefficient,
|
||||
{
|
||||
let mut matrix = Vec::with_capacity(output_channels.len());
|
||||
for output_channel in output_channels {
|
||||
let mut row = Vec::with_capacity(input_channels.len());
|
||||
for input_channel in input_channels {
|
||||
row.push(
|
||||
if input_channel != output_channel
|
||||
|| input_channel == &Channel::Silence
|
||||
|| output_channel == &Channel::Silence
|
||||
{
|
||||
0.0
|
||||
} else {
|
||||
1.0
|
||||
},
|
||||
);
|
||||
}
|
||||
matrix.push(row);
|
||||
}
|
||||
|
||||
// Convert the type of the coefficients from f64 to T::Coef.
|
||||
matrix
|
||||
.into_iter()
|
||||
.map(|row| row.into_iter().map(T::coefficient_from_f64).collect())
|
||||
.collect()
|
||||
}
|
||||
|
||||
// typical 5.1
|
||||
let input_channels = [
|
||||
Channel::FrontLeft,
|
||||
Channel::Silence,
|
||||
Channel::FrontRight,
|
||||
Channel::FrontCenter,
|
||||
Channel::BackLeft,
|
||||
Channel::BackRight,
|
||||
Channel::LowFrequency,
|
||||
];
|
||||
// going into 8 channels with a tagged stereo pair and discrete channels
|
||||
let output_channels = [
|
||||
Channel::Silence,
|
||||
Channel::FrontLeft,
|
||||
Channel::Silence,
|
||||
Channel::FrontCenter,
|
||||
Channel::BackCenter,
|
||||
Channel::FrontRight,
|
||||
Channel::Discrete,
|
||||
Channel::Discrete,
|
||||
Channel::Discrete,
|
||||
Channel::Discrete,
|
||||
Channel::Discrete,
|
||||
Channel::Discrete,
|
||||
];
|
||||
|
||||
// Get a redirect matrix since the output layout is asymmetric.
|
||||
let coefficient = Coefficient::<T>::create(&input_channels, &output_channels);
|
||||
// Get a pass-through matrix in the first 6 channels
|
||||
let coefficients = Coefficient::<T>::create(&input_channels, &output_channels);
|
||||
assert_is_diagonal::<T>(&coefficients, input_channels.len(), output_channels.len());
|
||||
}
|
||||
|
||||
let expected = compute_redirect_matrix::<T>(&input_channels, &output_channels);
|
||||
assert_eq!(coefficient.matrix, expected);
|
||||
fn test_get_discrete_mapping_matrix_too_many_channels<T>()
|
||||
where
|
||||
T: MixingCoefficient,
|
||||
T::Coef: Copy + Debug + PartialEq,
|
||||
{
|
||||
// 5.1.4
|
||||
let input_channels = [
|
||||
Channel::FrontLeft,
|
||||
Channel::FrontRight,
|
||||
Channel::FrontCenter,
|
||||
Channel::LowFrequency,
|
||||
Channel::FrontLeftOfCenter,
|
||||
Channel::FrontRightOfCenter,
|
||||
Channel::TopFrontLeft,
|
||||
Channel::TopFrontRight,
|
||||
Channel::BackLeft,
|
||||
Channel::BackRight,
|
||||
];
|
||||
// going into 8 channels with a tagged stereo pair and discrete channels
|
||||
let output_channels = [
|
||||
Channel::FrontLeft,
|
||||
Channel::FrontRight,
|
||||
Channel::Discrete,
|
||||
Channel::Discrete,
|
||||
Channel::Discrete,
|
||||
Channel::Discrete,
|
||||
Channel::Discrete,
|
||||
Channel::Discrete,
|
||||
];
|
||||
|
||||
println!(
|
||||
"{:?} = {:?} * {:?}",
|
||||
output_channels, coefficient.matrix, input_channels
|
||||
);
|
||||
// First 8 channels are to be played, last two are to be dropped.
|
||||
let coefficients = Coefficient::<T>::create(&input_channels, &output_channels);
|
||||
assert_is_diagonal(&coefficients, input_channels.len(), output_channels.len());
|
||||
}
|
||||
|
||||
fn test_get_regular_mapping_matrix_too_many_channels<T>()
|
||||
where
|
||||
T: MixingCoefficient,
|
||||
T::Coef: Copy + Debug + PartialEq,
|
||||
{
|
||||
// 5.1.4
|
||||
let input_channels = [
|
||||
Channel::FrontLeft,
|
||||
Channel::FrontRight,
|
||||
Channel::FrontCenter,
|
||||
Channel::LowFrequency,
|
||||
Channel::FrontLeftOfCenter,
|
||||
Channel::FrontRightOfCenter,
|
||||
Channel::TopFrontLeft,
|
||||
Channel::TopFrontRight,
|
||||
Channel::BackLeft,
|
||||
Channel::BackRight,
|
||||
];
|
||||
// going into a regular 5.1 sound card
|
||||
let output_channels = [
|
||||
Channel::FrontLeft,
|
||||
Channel::FrontRight,
|
||||
Channel::FrontCenter,
|
||||
Channel::LowFrequency,
|
||||
Channel::BackLeft,
|
||||
Channel::BackRight,
|
||||
];
|
||||
|
||||
let coefficients = Coefficient::<T>::create(&input_channels, &output_channels);
|
||||
|
||||
// Non-unity gain non-silence coefficients must be present when down mixing.
|
||||
let mut found_non_unity_non_silence = false;
|
||||
for row in coefficients.matrix.iter() {
|
||||
for coeff in row.iter() {
|
||||
if T::coefficient_from_f64(1.0) != *coeff || T::coefficient_from_f64(0.0) != *coeff
|
||||
{
|
||||
found_non_unity_non_silence = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
assert!(found_non_unity_non_silence);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -732,7 +837,7 @@ mod test {
|
|||
vec![4.0_f64, 6.0_f64, 10.0_f64],
|
||||
];
|
||||
|
||||
let mut max_row_sum: f64 = std::f64::MIN;
|
||||
let mut max_row_sum: f64 = f64::MIN;
|
||||
for row in &m {
|
||||
max_row_sum = max_row_sum.max(row.iter().sum());
|
||||
}
|
||||
|
@ -746,7 +851,7 @@ mod test {
|
|||
let smaller_max = max_row_sum - 0.5_f64;
|
||||
assert!(smaller_max > 0.0_f64);
|
||||
let n = Coefficient::<f32>::normalize(smaller_max, m);
|
||||
let mut max_row_sum: f64 = std::f64::MIN;
|
||||
let mut max_row_sum: f64 = f64::MIN;
|
||||
for row in &n {
|
||||
max_row_sum = max_row_sum.max(row.iter().sum());
|
||||
assert!(row.iter().sum::<f64>() <= smaller_max);
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{".circleci/config.yml":"7f3dc865105ca8f33965a7958b1fe2e627ae2d5a703f3b2a4ab6e2e796018597",".editorconfig":"4e53b182bcc78b83d7e1b5c03efa14d22d4955c4ed2514d1ba4e99c1eb1a50ba",".githooks/pre-push":"8b8b26544cd56f54c0c33812551f786bb25cb08c86dbfeb6bf3daad881c826a1",".github/workflows/test.yml":"ac8f4cf5b7631b5c738d50c0cf78113bd395940b9e76593904bbaf2d02d16a70",".travis.yml":"dc07bac53f70f16c9bdf52264bdc58500ae6018c1b4c567bc7642f6b4ca3cc35","Cargo.toml":"0fb7c56c04e05dacffa5176f885cb8019ee6ab7f885479be501aba0eaac2148f","LICENSE":"6e6f56aff5bbf3cbc60747e152fb1a719bd0716aaf6d711c554f57d92e96297c","README.md":"0007782a05a5330f739ad789c19c82562c82e32386b0447000fc72c0d48405bc","build-audiounit-rust-in-cubeb.sh":"d228a05985dcd02ec1ecac66a2b64dae5a530804a25a7054ccc95905aedfb7ef","install_git_hook.sh":"d38c8e51e636f6b90b489621ac34ccd1d1b1f40dccce3d178ed1da1c5068f16d","install_rustfmt_clippy.sh":"4ae90d8dcb9757cb3ae4ae142ef80e5377c0dde61c63f4a3c32418646e80ca7b","run_device_tests.sh":"90c2542fa3ff8a35fed894fae3a1aa0157117b7f0e28df14b8e6f7b1f1f43797","run_sanitizers.sh":"84e93a0da137803018f37403511e8c92760be730426bf6cea34419d93d1a7ff8","run_tests.sh":"bae82f66dd47a060b6fdcc238520084aec1079d5b1b1d66d103baa1ffaa8773d","src/backend/aggregate_device.rs":"db7d644358090b1d65ff2d53ad854369790ae4ad7dfa12b79888c0002c1b4950","src/backend/auto_release.rs":"050fdcee74cf46b9a8a85a877e166d72a853d33220f59cf734cbb6ea09daa441","src/backend/buffer_manager.rs":"e9bcf964347daa8952f98caa2746e34a31ea8908375204896593f56e4b6147ca","src/backend/device_property.rs":"a7622feaa41db1cd76fd35a85a022e44f4894e396a104a59008d5b8757d2ab4e","src/backend/mixer.rs":"ed299d3954e2a823060c870a8244673a7d4bca530830cb66b964d047a80ee3af","src/backend/mod.rs":"e52b79a17dbf7faa072ec87cc3e4201b907772104c3be777498275733b9c334e","src/backend/resampler.rs":"48bf8f56ae8d60dbabca6417b768000619abee8731ac3902164b45651ac08a4d","src/backend/tests/aggregate_device.rs":"770cf90f32b5ab2203476031c1fbc8379b713baa97bec36f7fd0d77fef1efd60","src/backend/tests/api.rs":"d72d7c0de8d12e880966948be4686bcf8c789f0ef19cb435c242fd72f2d252f9","src/backend/tests/backlog.rs":"3b189a7e036543c467cc242af0ed3332721179ee2b1c8847a6db563546f1ac52","src/backend/tests/device_change.rs":"babf50326fb38db24fe80f24f546e1b6ad04319ae8835bb372d893fc9b3038a2","src/backend/tests/device_property.rs":"73c25f579a995e8a59c9b7d391813afb75f739b5e2f825480cba04499a1d46e8","src/backend/tests/interfaces.rs":"654333cd6d6023e72ba392d98872d33bc55f8f052205a9f701aec72069449e24","src/backend/tests/manual.rs":"e550cc8bb7619bb80b68e49bf7f475c029e0f1b34323d1d30edcbe322cf4efc7","src/backend/tests/mod.rs":"8dba770023d7f9c4228f0e11915347f0e07da5fd818e3ee4478c4b197af9aa2a","src/backend/tests/parallel.rs":"a7ebd579339c40ca64c0757cc9da6baec641e670f226e1b2ec5049894700bd7a","src/backend/tests/tone.rs":"b028c67777b6453a26190b6a49785dfe28556adcbe179cb10862ce0d47ee8509","src/backend/tests/utils.rs":"80d7e4ebc06b23c63a4d2867e0c80e0bfe05449fa55edd21e785ed2c089bf7d5","src/backend/utils.rs":"6c3ffbcd602e6cc9f56deb9ecb07b2eef2e6f074ef924178e466f380aae5c595","src/capi.rs":"21b66b70545bf04ec719928004d1d9adb45b24ced51288f5b2993d79aaf78f5f","src/lib.rs":"5e586d45cd6b3722f0a6736d9252593299269817a153eef1930a5fb9bfbb56f5","todo.md":"efc1f012eb9a331a040cad4ac03aa79307f25885f71b6fb38f3ad7af8d7d515c"},"package":null}
|
||||
{"files":{".circleci/config.yml":"7f3dc865105ca8f33965a7958b1fe2e627ae2d5a703f3b2a4ab6e2e796018597",".editorconfig":"4e53b182bcc78b83d7e1b5c03efa14d22d4955c4ed2514d1ba4e99c1eb1a50ba",".githooks/pre-push":"8b8b26544cd56f54c0c33812551f786bb25cb08c86dbfeb6bf3daad881c826a1",".github/workflows/test.yml":"ac8f4cf5b7631b5c738d50c0cf78113bd395940b9e76593904bbaf2d02d16a70",".travis.yml":"dc07bac53f70f16c9bdf52264bdc58500ae6018c1b4c567bc7642f6b4ca3cc35","Cargo.toml":"a16b883e4fb41bdbbe5f68158040f181aeeffb4573ab0d493e9452f7c6f00541","LICENSE":"6e6f56aff5bbf3cbc60747e152fb1a719bd0716aaf6d711c554f57d92e96297c","README.md":"0007782a05a5330f739ad789c19c82562c82e32386b0447000fc72c0d48405bc","build-audiounit-rust-in-cubeb.sh":"d228a05985dcd02ec1ecac66a2b64dae5a530804a25a7054ccc95905aedfb7ef","install_git_hook.sh":"d38c8e51e636f6b90b489621ac34ccd1d1b1f40dccce3d178ed1da1c5068f16d","install_rustfmt_clippy.sh":"4ae90d8dcb9757cb3ae4ae142ef80e5377c0dde61c63f4a3c32418646e80ca7b","run_device_tests.sh":"90c2542fa3ff8a35fed894fae3a1aa0157117b7f0e28df14b8e6f7b1f1f43797","run_sanitizers.sh":"84e93a0da137803018f37403511e8c92760be730426bf6cea34419d93d1a7ff8","run_tests.sh":"bae82f66dd47a060b6fdcc238520084aec1079d5b1b1d66d103baa1ffaa8773d","src/backend/aggregate_device.rs":"db7d644358090b1d65ff2d53ad854369790ae4ad7dfa12b79888c0002c1b4950","src/backend/auto_release.rs":"050fdcee74cf46b9a8a85a877e166d72a853d33220f59cf734cbb6ea09daa441","src/backend/buffer_manager.rs":"e9bcf964347daa8952f98caa2746e34a31ea8908375204896593f56e4b6147ca","src/backend/device_property.rs":"a7622feaa41db1cd76fd35a85a022e44f4894e396a104a59008d5b8757d2ab4e","src/backend/mixer.rs":"c4d09291598cbffb2217b551770ec590f34b6dd6b461dd99b019d5bb70f0eef3","src/backend/mod.rs":"d75e116a58d63c6a7cb281d160066f48c8c449702dad58c762ad50d9512d7bd3","src/backend/resampler.rs":"48bf8f56ae8d60dbabca6417b768000619abee8731ac3902164b45651ac08a4d","src/backend/tests/aggregate_device.rs":"770cf90f32b5ab2203476031c1fbc8379b713baa97bec36f7fd0d77fef1efd60","src/backend/tests/api.rs":"773e88b506efccf0eacbf408d34dea1fb2c5a8500e7fe8a494a97f15f1ea41fc","src/backend/tests/backlog.rs":"3b189a7e036543c467cc242af0ed3332721179ee2b1c8847a6db563546f1ac52","src/backend/tests/device_change.rs":"babf50326fb38db24fe80f24f546e1b6ad04319ae8835bb372d893fc9b3038a2","src/backend/tests/device_property.rs":"73c25f579a995e8a59c9b7d391813afb75f739b5e2f825480cba04499a1d46e8","src/backend/tests/interfaces.rs":"654333cd6d6023e72ba392d98872d33bc55f8f052205a9f701aec72069449e24","src/backend/tests/manual.rs":"e550cc8bb7619bb80b68e49bf7f475c029e0f1b34323d1d30edcbe322cf4efc7","src/backend/tests/mod.rs":"8dba770023d7f9c4228f0e11915347f0e07da5fd818e3ee4478c4b197af9aa2a","src/backend/tests/parallel.rs":"a7ebd579339c40ca64c0757cc9da6baec641e670f226e1b2ec5049894700bd7a","src/backend/tests/tone.rs":"b028c67777b6453a26190b6a49785dfe28556adcbe179cb10862ce0d47ee8509","src/backend/tests/utils.rs":"80d7e4ebc06b23c63a4d2867e0c80e0bfe05449fa55edd21e785ed2c089bf7d5","src/backend/utils.rs":"6c3ffbcd602e6cc9f56deb9ecb07b2eef2e6f074ef924178e466f380aae5c595","src/capi.rs":"21b66b70545bf04ec719928004d1d9adb45b24ced51288f5b2993d79aaf78f5f","src/lib.rs":"5e586d45cd6b3722f0a6736d9252593299269817a153eef1930a5fb9bfbb56f5","todo.md":"efc1f012eb9a331a040cad4ac03aa79307f25885f71b6fb38f3ad7af8d7d515c"},"package":null}
|
|
@ -27,7 +27,7 @@ crate-type = [
|
|||
|
||||
[dependencies]
|
||||
atomic = "0.4"
|
||||
audio-mixer = "0.1"
|
||||
audio-mixer = "0.2"
|
||||
bitflags = "2"
|
||||
cubeb-backend = "0.12.0"
|
||||
float-cmp = "0.6"
|
||||
|
@ -43,3 +43,6 @@ path = "coreaudio-sys-utils"
|
|||
|
||||
[dev-dependencies]
|
||||
itertools = "0.11"
|
||||
|
||||
[features]
|
||||
audio-dump = []
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::os::raw::{c_int, c_void};
|
|||
extern crate audio_mixer;
|
||||
pub use self::audio_mixer::Channel;
|
||||
|
||||
const CHANNEL_OERDER: [audio_mixer::Channel; audio_mixer::Channel::count()] = [
|
||||
const CHANNEL_ORDER: [audio_mixer::Channel; audio_mixer::Channel::count()] = [
|
||||
audio_mixer::Channel::FrontLeft,
|
||||
audio_mixer::Channel::FrontRight,
|
||||
audio_mixer::Channel::FrontCenter,
|
||||
|
@ -25,6 +25,7 @@ const CHANNEL_OERDER: [audio_mixer::Channel; audio_mixer::Channel::count()] = [
|
|||
audio_mixer::Channel::TopBackCenter,
|
||||
audio_mixer::Channel::TopBackRight,
|
||||
audio_mixer::Channel::Silence,
|
||||
audio_mixer::Channel::Discrete,
|
||||
];
|
||||
|
||||
pub fn get_channel_order(channel_layout: ChannelLayout) -> Vec<audio_mixer::Channel> {
|
||||
|
@ -33,7 +34,7 @@ pub fn get_channel_order(channel_layout: ChannelLayout) -> Vec<audio_mixer::Chan
|
|||
let mut channel_index: usize = 0;
|
||||
while map != 0 {
|
||||
if map & 1 == 1 {
|
||||
order.push(CHANNEL_OERDER[channel_index]);
|
||||
order.push(CHANNEL_ORDER[channel_index]);
|
||||
}
|
||||
map >>= 1;
|
||||
channel_index += 1;
|
||||
|
@ -44,14 +45,14 @@ pub fn get_channel_order(channel_layout: ChannelLayout) -> Vec<audio_mixer::Chan
|
|||
fn get_default_channel_order(channel_count: usize) -> Vec<audio_mixer::Channel> {
|
||||
assert_ne!(channel_count, 0);
|
||||
let mut channels = Vec::with_capacity(channel_count);
|
||||
for channel in CHANNEL_OERDER.iter().take(channel_count) {
|
||||
for channel in CHANNEL_ORDER.iter().take(channel_count) {
|
||||
channels.push(*channel);
|
||||
}
|
||||
|
||||
if channel_count > CHANNEL_OERDER.len() {
|
||||
if channel_count > CHANNEL_ORDER.len() {
|
||||
channels.extend(vec![
|
||||
audio_mixer::Channel::Silence;
|
||||
channel_count - CHANNEL_OERDER.len()
|
||||
channel_count - CHANNEL_ORDER.len()
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -214,7 +215,7 @@ impl Mixer {
|
|||
if output_channels.is_empty()
|
||||
|| out_channel_count != output_channels.len()
|
||||
|| all_silence == output_channels
|
||||
|| Self::non_silent_duplicate_channel_present(&output_channels)
|
||||
|| Self::duplicate_channel_present(&output_channels)
|
||||
{
|
||||
cubeb_log!("Use invalid layout. Apply default layout instead");
|
||||
output_channels = get_default_channel_order(out_channel_count);
|
||||
|
@ -261,10 +262,10 @@ impl Mixer {
|
|||
)
|
||||
}
|
||||
|
||||
fn non_silent_duplicate_channel_present(channels: &[audio_mixer::Channel]) -> bool {
|
||||
fn duplicate_channel_present(channels: &[audio_mixer::Channel]) -> bool {
|
||||
let mut bitmap: u32 = 0;
|
||||
for channel in channels {
|
||||
if channel != &Channel::Silence {
|
||||
if channel != &Channel::Silence && channel != &Channel::Discrete {
|
||||
if (bitmap & channel.bitmask()) != 0 {
|
||||
return true;
|
||||
}
|
||||
|
@ -456,14 +457,14 @@ fn test_get_channel_order() {
|
|||
|
||||
#[test]
|
||||
fn test_get_default_channel_order() {
|
||||
for len in 1..CHANNEL_OERDER.len() + 10 {
|
||||
for len in 1..CHANNEL_ORDER.len() + 10 {
|
||||
let channels = get_default_channel_order(len);
|
||||
if len <= CHANNEL_OERDER.len() {
|
||||
assert_eq!(channels, &CHANNEL_OERDER[..len]);
|
||||
if len <= CHANNEL_ORDER.len() {
|
||||
assert_eq!(channels, &CHANNEL_ORDER[..len]);
|
||||
} else {
|
||||
let silences = vec![audio_mixer::Channel::Silence; len - CHANNEL_OERDER.len()];
|
||||
assert_eq!(channels[..CHANNEL_OERDER.len()], CHANNEL_OERDER);
|
||||
assert_eq!(&channels[CHANNEL_OERDER.len()..], silences.as_slice());
|
||||
let silences = vec![audio_mixer::Channel::Silence; len - CHANNEL_ORDER.len()];
|
||||
assert_eq!(channels[..CHANNEL_ORDER.len()], CHANNEL_ORDER);
|
||||
assert_eq!(&channels[CHANNEL_ORDER.len()..], silences.as_slice());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -478,7 +479,7 @@ fn test_non_silent_duplicate_channels() {
|
|||
Channel::Silence,
|
||||
Channel::FrontRight,
|
||||
];
|
||||
assert!(Mixer::non_silent_duplicate_channel_present(&duplicate));
|
||||
assert!(Mixer::duplicate_channel_present(&duplicate));
|
||||
|
||||
let non_duplicate = [
|
||||
Channel::FrontLeft,
|
||||
|
@ -488,5 +489,25 @@ fn test_non_silent_duplicate_channels() {
|
|||
Channel::Silence,
|
||||
Channel::Silence,
|
||||
];
|
||||
assert!(!Mixer::non_silent_duplicate_channel_present(&non_duplicate));
|
||||
assert!(!Mixer::duplicate_channel_present(&non_duplicate));
|
||||
|
||||
let duplicate = [
|
||||
Channel::FrontLeft,
|
||||
Channel::Discrete,
|
||||
Channel::FrontRight,
|
||||
Channel::FrontCenter,
|
||||
Channel::Discrete,
|
||||
Channel::FrontRight,
|
||||
];
|
||||
assert!(Mixer::duplicate_channel_present(&duplicate));
|
||||
|
||||
let non_duplicate = [
|
||||
Channel::FrontLeft,
|
||||
Channel::Discrete,
|
||||
Channel::FrontRight,
|
||||
Channel::FrontCenter,
|
||||
Channel::Discrete,
|
||||
Channel::Discrete,
|
||||
];
|
||||
assert!(!Mixer::duplicate_channel_present(&non_duplicate));
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ use self::mixer::*;
|
|||
use self::resampler::*;
|
||||
use self::utils::*;
|
||||
use backend::ringbuf::RingBuffer;
|
||||
#[cfg(feature = "audio_dump")]
|
||||
use cubeb_backend::ffi::cubeb_audio_dump_stream_t;
|
||||
use cubeb_backend::{
|
||||
ffi, ChannelLayout, Context, ContextOps, DeviceCollectionRef, DeviceId, DeviceRef, DeviceType,
|
||||
Error, InputProcessingParams, Ops, Result, SampleFormat, State, Stream, StreamOps,
|
||||
|
@ -114,6 +116,16 @@ lazy_static! {
|
|||
};
|
||||
}
|
||||
|
||||
#[cfg(feature = "audio_dump")]
|
||||
fn dump_audio(stream: cubeb_audio_dump_stream_t, audio_samples: *mut c_void, count: u32) {
|
||||
unsafe {
|
||||
let rv = ffi::cubeb_audio_dump_write(stream, audio_samples, count);
|
||||
if rv != 0 {
|
||||
cubeb_alog!("Error dumping audio data");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn make_sized_audio_channel_layout(sz: usize) -> AutoRelease<AudioChannelLayout> {
|
||||
assert!(sz >= mem::size_of::<AudioChannelLayout>());
|
||||
assert_eq!(
|
||||
|
@ -194,7 +206,12 @@ impl From<CAChannelLabel> for mixer::Channel {
|
|||
sys::kAudioChannelLabel_TopBackLeft => mixer::Channel::TopBackLeft,
|
||||
sys::kAudioChannelLabel_TopBackCenter => mixer::Channel::TopBackCenter,
|
||||
sys::kAudioChannelLabel_TopBackRight => mixer::Channel::TopBackRight,
|
||||
_ => mixer::Channel::Silence,
|
||||
sys::kAudioChannelLabel_Unknown => mixer::Channel::Discrete,
|
||||
sys::kAudioChannelLabel_Unused => mixer::Channel::Silence,
|
||||
v => {
|
||||
eprintln!("Warning: channel label value {} isn't handled", v);
|
||||
mixer::Channel::Silence
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -551,6 +568,16 @@ extern "C" fn audiounit_input_callback(
|
|||
ErrorHandle::Reinit
|
||||
} else {
|
||||
assert_eq!(status, NO_ERR);
|
||||
|
||||
#[cfg(feature = "audio_dump")]
|
||||
{
|
||||
dump_audio(
|
||||
stm.core_stream_data.audio_dump_input,
|
||||
input_buffer_list.mBuffers[0].mData,
|
||||
input_frames * stm.core_stream_data.input_dev_desc.mChannelsPerFrame,
|
||||
);
|
||||
}
|
||||
|
||||
input_buffer_manager
|
||||
.push_data(input_buffer_list.mBuffers[0].mData, input_frames as usize);
|
||||
ErrorHandle::Return(status)
|
||||
|
@ -708,6 +735,14 @@ extern "C" fn audiounit_output_callback(
|
|||
if stm.stopped.load(Ordering::SeqCst) {
|
||||
cubeb_alog!("({:p}) output stopped.", stm as *const AudioUnitStream);
|
||||
audiounit_make_silent(&buffers[0]);
|
||||
#[cfg(feature = "audio_dump")]
|
||||
{
|
||||
dump_audio(
|
||||
stm.core_stream_data.audio_dump_output,
|
||||
buffers[0].mData,
|
||||
output_frames * stm.core_stream_data.output_dev_desc.mChannelsPerFrame,
|
||||
);
|
||||
}
|
||||
return NO_ERR;
|
||||
}
|
||||
|
||||
|
@ -718,12 +753,20 @@ extern "C" fn audiounit_output_callback(
|
|||
cubeb_alog!("({:p}) output drained.", stm as *const AudioUnitStream);
|
||||
stm.notify_state_changed(State::Drained);
|
||||
let queue = stm.queue.clone();
|
||||
audiounit_make_silent(&buffers[0]);
|
||||
#[cfg(feature = "audio_dump")]
|
||||
{
|
||||
dump_audio(
|
||||
stm.core_stream_data.audio_dump_output,
|
||||
buffers[0].mData,
|
||||
output_frames * stm.core_stream_data.output_dev_desc.mChannelsPerFrame,
|
||||
);
|
||||
}
|
||||
// Use a new thread, through the queue, to avoid deadlock when calling
|
||||
// AudioOutputUnitStop method from inside render callback
|
||||
queue.run_async(move || {
|
||||
stm.core_stream_data.stop_audiounits();
|
||||
});
|
||||
audiounit_make_silent(&buffers[0]);
|
||||
return NO_ERR;
|
||||
}
|
||||
|
||||
|
@ -846,12 +889,21 @@ extern "C" fn audiounit_output_callback(
|
|||
stm.stopped.store(true, Ordering::SeqCst);
|
||||
stm.notify_state_changed(State::Error);
|
||||
let queue = stm.queue.clone();
|
||||
audiounit_make_silent(&buffers[0]);
|
||||
|
||||
#[cfg(feature = "audio_dump")]
|
||||
{
|
||||
dump_audio(
|
||||
stm.core_stream_data.audio_dump_output,
|
||||
buffers[0].mData,
|
||||
output_frames * stm.core_stream_data.output_dev_desc.mChannelsPerFrame,
|
||||
);
|
||||
}
|
||||
// Use a new thread, through the queue, to avoid deadlock when calling
|
||||
// AudioOutputUnitStop method from inside render callback
|
||||
queue.run_async(move || {
|
||||
stm.core_stream_data.stop_audiounits();
|
||||
});
|
||||
audiounit_make_silent(&buffers[0]);
|
||||
return NO_ERR;
|
||||
}
|
||||
|
||||
|
@ -898,6 +950,15 @@ extern "C" fn audiounit_output_callback(
|
|||
buffers[0].mDataByteSize as usize,
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(feature = "audio_dump")]
|
||||
{
|
||||
dump_audio(
|
||||
stm.core_stream_data.audio_dump_output,
|
||||
buffers[0].mData,
|
||||
output_frames * stm.core_stream_data.output_dev_desc.mChannelsPerFrame,
|
||||
);
|
||||
}
|
||||
NO_ERR
|
||||
}
|
||||
|
||||
|
@ -3010,6 +3071,14 @@ struct CoreStreamData<'ctx> {
|
|||
output_alive_listener: Option<device_property_listener>,
|
||||
output_source_listener: Option<device_property_listener>,
|
||||
input_logging: Option<InputCallbackLogger>,
|
||||
#[cfg(feature = "audio_dump")]
|
||||
audio_dump_session: ffi::cubeb_audio_dump_session_t,
|
||||
#[cfg(feature = "audio_dump")]
|
||||
audio_dump_session_running: bool,
|
||||
#[cfg(feature = "audio_dump")]
|
||||
audio_dump_input: ffi::cubeb_audio_dump_stream_t,
|
||||
#[cfg(feature = "audio_dump")]
|
||||
audio_dump_output: ffi::cubeb_audio_dump_stream_t,
|
||||
}
|
||||
|
||||
impl<'ctx> Default for CoreStreamData<'ctx> {
|
||||
|
@ -3050,6 +3119,14 @@ impl<'ctx> Default for CoreStreamData<'ctx> {
|
|||
output_alive_listener: None,
|
||||
output_source_listener: None,
|
||||
input_logging: None,
|
||||
#[cfg(feature = "audio_dump")]
|
||||
audio_dump_session: ptr::null_mut(),
|
||||
#[cfg(feature = "audio_dump")]
|
||||
audio_dump_session_running: false,
|
||||
#[cfg(feature = "audio_dump")]
|
||||
audio_dump_input: ptr::null_mut(),
|
||||
#[cfg(feature = "audio_dump")]
|
||||
audio_dump_output: ptr::null_mut(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3097,6 +3174,14 @@ impl<'ctx> CoreStreamData<'ctx> {
|
|||
output_alive_listener: None,
|
||||
output_source_listener: None,
|
||||
input_logging: None,
|
||||
#[cfg(feature = "audio_dump")]
|
||||
audio_dump_session: ptr::null_mut(),
|
||||
#[cfg(feature = "audio_dump")]
|
||||
audio_dump_session_running: false,
|
||||
#[cfg(feature = "audio_dump")]
|
||||
audio_dump_input: ptr::null_mut(),
|
||||
#[cfg(feature = "audio_dump")]
|
||||
audio_dump_output: ptr::null_mut(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3454,6 +3539,11 @@ impl<'ctx> CoreStreamData<'ctx> {
|
|||
assert!(!self.stm_ptr.is_null());
|
||||
let stream = unsafe { &(*self.stm_ptr) };
|
||||
|
||||
#[cfg(feature = "audio_dump")]
|
||||
unsafe {
|
||||
ffi::cubeb_audio_dump_init(&mut self.audio_dump_session);
|
||||
}
|
||||
|
||||
// Configure I/O stream
|
||||
if self.has_input() {
|
||||
assert!(!self.input_unit.is_null());
|
||||
|
@ -3543,6 +3633,26 @@ impl<'ctx> CoreStreamData<'ctx> {
|
|||
e
|
||||
})?;
|
||||
|
||||
#[cfg(feature = "audio_dump")]
|
||||
{
|
||||
let name = format!("input-{:p}.wav", self.stm_ptr);
|
||||
let cname = CString::new(name).expect("OK");
|
||||
let rv = unsafe {
|
||||
ffi::cubeb_audio_dump_stream_init(
|
||||
self.audio_dump_session,
|
||||
&mut self.audio_dump_input,
|
||||
*params.as_ptr(),
|
||||
cname.as_ptr(),
|
||||
)
|
||||
};
|
||||
if rv == 0 {
|
||||
assert_ne!(self.audio_dump_input, ptr::null_mut(),);
|
||||
cubeb_log!("Successfully inited audio dump for input");
|
||||
} else {
|
||||
cubeb_log!("Failed to init audio dump for input");
|
||||
}
|
||||
}
|
||||
|
||||
assert_eq!(self.input_dev_desc.mSampleRate, input_hw_desc.mSampleRate);
|
||||
|
||||
// Use latency to set buffer size
|
||||
|
@ -3739,6 +3849,26 @@ impl<'ctx> CoreStreamData<'ctx> {
|
|||
e
|
||||
})?;
|
||||
|
||||
#[cfg(feature = "audio_dump")]
|
||||
{
|
||||
let name = format!("output-{:p}.wav", self.stm_ptr);
|
||||
let cname = CString::new(name).expect("OK");
|
||||
let rv = unsafe {
|
||||
ffi::cubeb_audio_dump_stream_init(
|
||||
self.audio_dump_session,
|
||||
&mut self.audio_dump_output,
|
||||
*params.as_ptr(),
|
||||
cname.as_ptr(),
|
||||
)
|
||||
};
|
||||
if rv == 0 {
|
||||
assert_ne!(self.audio_dump_output, ptr::null_mut(),);
|
||||
cubeb_log!("Successfully inited audio dump for output");
|
||||
} else {
|
||||
cubeb_log!("Failed to init audio dump for output");
|
||||
}
|
||||
}
|
||||
|
||||
let device_layout = self
|
||||
.get_output_channel_layout()
|
||||
.map_err(|e| {
|
||||
|
@ -3908,6 +4038,12 @@ impl<'ctx> CoreStreamData<'ctx> {
|
|||
self.input_logging = Some(InputCallbackLogger::new());
|
||||
}
|
||||
|
||||
#[cfg(feature = "audio_dump")]
|
||||
{
|
||||
unsafe { ffi::cubeb_audio_dump_start(self.audio_dump_session) };
|
||||
self.audio_dump_session_running = true;
|
||||
}
|
||||
|
||||
if !self.input_unit.is_null() {
|
||||
let r = audio_unit_initialize(self.input_unit);
|
||||
if r != NO_ERR {
|
||||
|
@ -4081,6 +4217,36 @@ impl<'ctx> CoreStreamData<'ctx> {
|
|||
// Return the VPIO unit if present.
|
||||
self.voiceprocessing_unit_handle = None;
|
||||
|
||||
#[cfg(feature = "audio_dump")]
|
||||
{
|
||||
if !self.audio_dump_session.is_null() {
|
||||
unsafe {
|
||||
ffi::cubeb_audio_dump_stop(self.audio_dump_session);
|
||||
if !self.audio_dump_input.is_null() {
|
||||
let rv = ffi::cubeb_audio_dump_stream_shutdown(
|
||||
self.audio_dump_session,
|
||||
self.audio_dump_input,
|
||||
);
|
||||
if rv != 0 {
|
||||
cubeb_log!("Failed to shutdown audio dump for input");
|
||||
}
|
||||
}
|
||||
if !self.audio_dump_output.is_null() {
|
||||
let rv = ffi::cubeb_audio_dump_stream_shutdown(
|
||||
self.audio_dump_session,
|
||||
self.audio_dump_output,
|
||||
);
|
||||
if rv != 0 {
|
||||
cubeb_log!("Failed to shutdown audio dump for output");
|
||||
}
|
||||
}
|
||||
ffi::cubeb_audio_dump_shutdown(self.audio_dump_session);
|
||||
self.audio_dump_session = ptr::null_mut();
|
||||
self.audio_dump_session_running = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.resampler.destroy();
|
||||
self.mixer = None;
|
||||
self.aggregate_device = None;
|
||||
|
|
|
@ -376,7 +376,6 @@ fn test_get_default_device_id_with_inout_type() {
|
|||
#[test]
|
||||
fn test_convert_channel_layout() {
|
||||
let pairs = [
|
||||
(vec![kAudioObjectUnknown], vec![mixer::Channel::Silence]),
|
||||
(
|
||||
vec![kAudioChannelLabel_Mono],
|
||||
vec![mixer::Channel::FrontCenter],
|
||||
|
@ -398,7 +397,7 @@ fn test_convert_channel_layout() {
|
|||
vec![
|
||||
mixer::Channel::FrontLeft,
|
||||
mixer::Channel::FrontRight,
|
||||
mixer::Channel::Silence,
|
||||
mixer::Channel::Discrete,
|
||||
],
|
||||
),
|
||||
(
|
||||
|
|
Загрузка…
Ссылка в новой задаче