diff --git a/.cargo/config.in b/.cargo/config.in index 26210eecbd09..595cc107c289 100644 --- a/.cargo/config.in +++ b/.cargo/config.in @@ -65,7 +65,7 @@ replace-with = "vendored-sources" [source."https://github.com/ChunMinChang/cubeb-coreaudio-rs"] git = "https://github.com/ChunMinChang/cubeb-coreaudio-rs" replace-with = "vendored-sources" -rev = "868d847c2e95096b6eec629dfed77ef363363ecb" +rev = "5fcbd99e1b7356be1efcdc41654d495bd4c71c8c" [source.crates-io] replace-with = "vendored-sources" diff --git a/Cargo.lock b/Cargo.lock index 747c1b9f8864..2733601056d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -626,7 +626,7 @@ dependencies = [ [[package]] name = "coreaudio-sys-utils" version = "0.1.0" -source = "git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=868d847c2e95096b6eec629dfed77ef363363ecb#868d847c2e95096b6eec629dfed77ef363363ecb" +source = "git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=5fcbd99e1b7356be1efcdc41654d495bd4c71c8c#5fcbd99e1b7356be1efcdc41654d495bd4c71c8c" dependencies = [ "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "coreaudio-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -848,11 +848,11 @@ dependencies = [ [[package]] name = "cubeb-coreaudio" version = "0.1.0" -source = "git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=868d847c2e95096b6eec629dfed77ef363363ecb#868d847c2e95096b6eec629dfed77ef363363ecb" +source = "git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=5fcbd99e1b7356be1efcdc41654d495bd4c71c8c#5fcbd99e1b7356be1efcdc41654d495bd4c71c8c" dependencies = [ "atomic 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "coreaudio-sys-utils 0.1.0 (git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=868d847c2e95096b6eec629dfed77ef363363ecb)", + "coreaudio-sys-utils 0.1.0 (git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=5fcbd99e1b7356be1efcdc41654d495bd4c71c8c)", "cubeb-backend 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1473,7 +1473,7 @@ dependencies = [ "cert_storage 0.0.1", "chardetng_c 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "cose-c 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "cubeb-coreaudio 0.1.0 (git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=868d847c2e95096b6eec629dfed77ef363363ecb)", + "cubeb-coreaudio 0.1.0 (git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=5fcbd99e1b7356be1efcdc41654d495bd4c71c8c)", "cubeb-pulse 0.3.0 (git+https://github.com/djg/cubeb-pulse-rs?rev=8069f8f4189982e0b38fa6dc8993dd4fab41f728)", "cubeb-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "encoding_glue 0.1.0", @@ -4697,7 +4697,7 @@ dependencies = [ "checksum core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9" "checksum core-text 13.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f3f46450d6f2397261af420b4ccce23807add2e45fa206410a03d66fb7f050ae" "checksum coreaudio-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e8f5954c1c7ccb55340443e8b29fca24013545a5e7d72c1ca7db4fc02b982ce" -"checksum coreaudio-sys-utils 0.1.0 (git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=868d847c2e95096b6eec629dfed77ef363363ecb)" = "" +"checksum coreaudio-sys-utils 0.1.0 (git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=5fcbd99e1b7356be1efcdc41654d495bd4c71c8c)" = "" "checksum cose 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "72fa26cb151d3ae4b70f63d67d0fed57ce04220feafafbae7f503bef7aae590d" "checksum cose-c 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "49726015ab0ca765144fcca61e4a7a543a16b795a777fa53f554da2fffff9a94" "checksum cranelift-bforest 0.51.0 (git+https://github.com/bytecodealliance/cranelift?rev=ec787eb281bb2e18e191508c17abe694e91f0677)" = "" @@ -4721,7 +4721,7 @@ dependencies = [ "checksum cubeb 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3cbcdfde9ea319160af6eff068ffaa96aad3532e1b5c0ebc134614cfacacae24" "checksum cubeb-backend 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5a1e7add4e7642a8aebb24172922318482bed52389a12cb339f728bbd4c4ed9c" "checksum cubeb-core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfd9b2ea1cb6afed9419b0d18fc4093df552ccb2300eb57793629f8cd370b4c8" -"checksum cubeb-coreaudio 0.1.0 (git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=868d847c2e95096b6eec629dfed77ef363363ecb)" = "" +"checksum cubeb-coreaudio 0.1.0 (git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=5fcbd99e1b7356be1efcdc41654d495bd4c71c8c)" = "" "checksum cubeb-pulse 0.3.0 (git+https://github.com/djg/cubeb-pulse-rs?rev=8069f8f4189982e0b38fa6dc8993dd4fab41f728)" = "" "checksum cubeb-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "309c5839c5fa03c08363bd308566cbe4654b25a9984342d7546a33d55b80a3d6" "checksum d3d12 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc7ed48e89905e5e146bcc1951cc3facb9e44aea9adf5dc01078cda1bd24b662" diff --git a/third_party/rust/cubeb-coreaudio/.cargo-checksum.json b/third_party/rust/cubeb-coreaudio/.cargo-checksum.json index cacefbb9e7fe..57492f8b5ebc 100644 --- a/third_party/rust/cubeb-coreaudio/.cargo-checksum.json +++ b/third_party/rust/cubeb-coreaudio/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".editorconfig":"4e53b182bcc78b83d7e1b5c03efa14d22d4955c4ed2514d1ba4e99c1eb1a50ba",".travis.yml":"bea421508af5f4d00b941866dae0ae7d94a51b9276688a7f626686e8ed8fbbf3","Cargo.toml":"d1b1a03695cf8c92daa58cccb391a03b1d0b82a70505424c25fa40aba19411af","LICENSE":"6e6f56aff5bbf3cbc60747e152fb1a719bd0716aaf6d711c554f57d92e96297c","README.md":"72d8a890d6bda3cdba393432e5ae2018a385980785ebb2b96e9c3f82a48a1b59","run_tests.sh":"c764a89fe2a6b7ccdeb01895d29b2017c5b76f468aff456050babd66c1472687","src/backend/aggregate_device.rs":"7cd732f3e1e71876753515b26ee69a315414e58869216e99ff95c6828408c4db","src/backend/auto_array.rs":"5f35545baba2b005e13a2225bd1cbdd94ffc2097554d61479929bfc5442a6dd6","src/backend/auto_release.rs":"050fdcee74cf46b9a8a85a877e166d72a853d33220f59cf734cbb6ea09daa441","src/backend/device_property.rs":"1b066b48ed09026a9286b1b8f40e2720854c3410b0f02c795a580792fda34ea9","src/backend/mixer.rs":"74dcac459493e2f919b61ed3bebe500027e422eb06b1ecd30b73a47079c61f7c","src/backend/mod.rs":"67b445d216cad0658c3844cd608ddf1bfc8ab1559ffbee8edf5c340e08a9ce77","src/backend/resampler.rs":"fd1281d28a4db1659d2f75e43b8457651745e1b6eb5a53a77f04d752135f6dc7","src/backend/tests/aggregate_device.rs":"107f5c637844cd5ae43d2b42cec4ef3369bb702751586078c0a9d50f039161cd","src/backend/tests/api.rs":"d76c1574179085e0c1342614cd674e5aa211dd456f3725aeb294def6b32750fd","src/backend/tests/backlog.rs":"3b189a7e036543c467cc242af0ed3332721179ee2b1c8847a6db563546f1ac52","src/backend/tests/device_change.rs":"bebda3dbbcd432d7c545dbe27c388773f61f68a1c8b947f61deb358682dbe53b","src/backend/tests/device_property.rs":"b1a9ae79aa5b9a3f180040d0ef0954b134680d586882d2062c5e017b555bff57","src/backend/tests/interfaces.rs":"01fc2d54ddb50f014a44f9c137f078645738bcc81e48140a3e7ae68e18a61b6b","src/backend/tests/manual.rs":"c0b8888e1f7fc09913862300023452753384e038b7433e3975b772988925f52c","src/backend/tests/mod.rs":"8dba770023d7f9c4228f0e11915347f0e07da5fd818e3ee4478c4b197af9aa2a","src/backend/tests/parallel.rs":"f9e1883660d6146b6e5075806561f5f689810e25c5e7764dfd28c9b939821a49","src/backend/tests/tone.rs":"16150438317ce501986734167b5fb97bfec567228acbcd8f3b4c4484c22f29e0","src/backend/tests/utils.rs":"981e4669902231d10f8c3d5c39d82358acc8159f026b8be27f4ab76ef19fcda3","src/backend/utils.rs":"ee77bc266d672d3d9e23eb3290c1f897687394c6e459338804a17433380a6fd2","src/capi.rs":"61f8f0c4373adaefba1eb6e7084687e83a10136db96438bc35884327668e411f","src/lib.rs":"1ff4b738ed194061fca4ff745f847dea4de4e7a4fa1f898e7b4ad5e70c62386d","todo.md":"a66296c220cad24d08ee780308007a702f7e421edf0bb60464c3ce8feeda1882"},"package":null} \ No newline at end of file +{"files":{".editorconfig":"4e53b182bcc78b83d7e1b5c03efa14d22d4955c4ed2514d1ba4e99c1eb1a50ba",".travis.yml":"bea421508af5f4d00b941866dae0ae7d94a51b9276688a7f626686e8ed8fbbf3","Cargo.toml":"d1b1a03695cf8c92daa58cccb391a03b1d0b82a70505424c25fa40aba19411af","LICENSE":"6e6f56aff5bbf3cbc60747e152fb1a719bd0716aaf6d711c554f57d92e96297c","README.md":"72d8a890d6bda3cdba393432e5ae2018a385980785ebb2b96e9c3f82a48a1b59","run_tests.sh":"c764a89fe2a6b7ccdeb01895d29b2017c5b76f468aff456050babd66c1472687","src/backend/aggregate_device.rs":"7cd732f3e1e71876753515b26ee69a315414e58869216e99ff95c6828408c4db","src/backend/auto_array.rs":"5f35545baba2b005e13a2225bd1cbdd94ffc2097554d61479929bfc5442a6dd6","src/backend/auto_release.rs":"050fdcee74cf46b9a8a85a877e166d72a853d33220f59cf734cbb6ea09daa441","src/backend/device_property.rs":"1b066b48ed09026a9286b1b8f40e2720854c3410b0f02c795a580792fda34ea9","src/backend/mixer.rs":"74dcac459493e2f919b61ed3bebe500027e422eb06b1ecd30b73a47079c61f7c","src/backend/mod.rs":"567c32965797212d33464981b847dc934fdc73c8f5ea226ea3243a585f8630d2","src/backend/resampler.rs":"fd1281d28a4db1659d2f75e43b8457651745e1b6eb5a53a77f04d752135f6dc7","src/backend/tests/aggregate_device.rs":"107f5c637844cd5ae43d2b42cec4ef3369bb702751586078c0a9d50f039161cd","src/backend/tests/api.rs":"d76c1574179085e0c1342614cd674e5aa211dd456f3725aeb294def6b32750fd","src/backend/tests/backlog.rs":"3b189a7e036543c467cc242af0ed3332721179ee2b1c8847a6db563546f1ac52","src/backend/tests/device_change.rs":"bebda3dbbcd432d7c545dbe27c388773f61f68a1c8b947f61deb358682dbe53b","src/backend/tests/device_property.rs":"b1a9ae79aa5b9a3f180040d0ef0954b134680d586882d2062c5e017b555bff57","src/backend/tests/interfaces.rs":"01fc2d54ddb50f014a44f9c137f078645738bcc81e48140a3e7ae68e18a61b6b","src/backend/tests/manual.rs":"c0b8888e1f7fc09913862300023452753384e038b7433e3975b772988925f52c","src/backend/tests/mod.rs":"8dba770023d7f9c4228f0e11915347f0e07da5fd818e3ee4478c4b197af9aa2a","src/backend/tests/parallel.rs":"f9e1883660d6146b6e5075806561f5f689810e25c5e7764dfd28c9b939821a49","src/backend/tests/tone.rs":"16150438317ce501986734167b5fb97bfec567228acbcd8f3b4c4484c22f29e0","src/backend/tests/utils.rs":"981e4669902231d10f8c3d5c39d82358acc8159f026b8be27f4ab76ef19fcda3","src/backend/utils.rs":"ee77bc266d672d3d9e23eb3290c1f897687394c6e459338804a17433380a6fd2","src/capi.rs":"61f8f0c4373adaefba1eb6e7084687e83a10136db96438bc35884327668e411f","src/lib.rs":"1ff4b738ed194061fca4ff745f847dea4de4e7a4fa1f898e7b4ad5e70c62386d","todo.md":"a66296c220cad24d08ee780308007a702f7e421edf0bb60464c3ce8feeda1882"},"package":null} \ No newline at end of file diff --git a/third_party/rust/cubeb-coreaudio/src/backend/mod.rs b/third_party/rust/cubeb-coreaudio/src/backend/mod.rs index 690582191b20..382ada42374f 100644 --- a/third_party/rust/cubeb-coreaudio/src/backend/mod.rs +++ b/third_party/rust/cubeb-coreaudio/src/backend/mod.rs @@ -1490,16 +1490,10 @@ fn get_channel_count(devid: AudioObjectID, devtype: DeviceType) -> Result { fn get_range_of_sample_rates( devid: AudioObjectID, devtype: DeviceType, -) -> std::result::Result<(f64, f64), String> { - let result = get_ranges_of_device_sample_rate(devid, devtype); - if let Err(e) = result { - return Err(format!("status {}", e).to_string()); - } - let rates = result.unwrap(); - if rates.is_empty() { - return Err(String::from("No data")); - } +) -> std::result::Result<(f64, f64), OSStatus> { let (mut min, mut max) = (std::f64::MAX, std::f64::MIN); + let rates = get_ranges_of_device_sample_rate(devid, devtype)?; + assert!(!rates.is_empty()); for rate in rates { if rate.mMaximum > max { max = rate.mMaximum; @@ -3227,7 +3221,7 @@ impl<'ctx> AudioUnitStream<'ctx> { ) } - fn notify_state_changed(&self, state: State) { + fn notify_state_changed(&mut self, state: State) { if self.state_callback.is_none() { return; } @@ -3281,6 +3275,7 @@ impl<'ctx> AudioUnitStream<'ctx> { "({:p}) Create input device info failed. This can happen when last media device is unplugged", self.core_stream_data.stm_ptr ); + self.core_stream_data.close(); e })?; } @@ -3293,6 +3288,7 @@ impl<'ctx> AudioUnitStream<'ctx> { "({:p}) Create output device info failed. This can happen when last media device is unplugged", self.core_stream_data.stm_ptr ); + self.core_stream_data.close(); e })?; @@ -3309,6 +3305,7 @@ impl<'ctx> AudioUnitStream<'ctx> { "({:p}) Create input device info failed. This can happen when last media device is unplugged", self.core_stream_data.stm_ptr ); + self.core_stream_data.close(); e })?; self.core_stream_data.setup().map_err(|e| { @@ -3316,6 +3313,7 @@ impl<'ctx> AudioUnitStream<'ctx> { "({:p}) Second stream reinit failed.", self.core_stream_data.stm_ptr ); + self.core_stream_data.close(); e })?; } @@ -3332,6 +3330,7 @@ impl<'ctx> AudioUnitStream<'ctx> { "({:p}) Start audiounit failed.", self.core_stream_data.stm_ptr ); + self.core_stream_data.close(); e })?; } @@ -3366,7 +3365,6 @@ impl<'ctx> AudioUnitStream<'ctx> { } if stm_guard.reinit().is_err() { - stm_guard.core_stream_data.close(); stm_guard.notify_state_changed(State::Error); cubeb_log!( "({:p}) Could not reopen the stream after switching.", diff --git a/toolkit/library/rust/shared/Cargo.toml b/toolkit/library/rust/shared/Cargo.toml index b21c73b01fea..ca35c28965a3 100644 --- a/toolkit/library/rust/shared/Cargo.toml +++ b/toolkit/library/rust/shared/Cargo.toml @@ -19,7 +19,7 @@ static_prefs = { path = "../../../../modules/libpref/init/static_prefs" } profiler_helper = { path = "../../../../tools/profiler/rust-helper", optional = true } mozurl = { path = "../../../../netwerk/base/mozurl" } webrender_bindings = { path = "../../../../gfx/webrender_bindings", optional = true } -cubeb-coreaudio = { git = "https://github.com/ChunMinChang/cubeb-coreaudio-rs", rev = "868d847c2e95096b6eec629dfed77ef363363ecb", optional = true } +cubeb-coreaudio = { git = "https://github.com/ChunMinChang/cubeb-coreaudio-rs", rev = "5fcbd99e1b7356be1efcdc41654d495bd4c71c8c", optional = true } cubeb-pulse = { git = "https://github.com/djg/cubeb-pulse-rs", rev="8069f8f4189982e0b38fa6dc8993dd4fab41f728", optional = true, features=["pulse-dlopen"] } cubeb-sys = { version = "0.6", optional = true, features=["gecko-in-tree"] } encoding_glue = { path = "../../../../intl/encoding_glue" }