Skip to content

Commit

Permalink
Bug 1603761 - Update cubeb-coreaudio to 868d847. r=padenot
Browse files Browse the repository at this point in the history
Pick commits:
b1ad8b9 - Minor cleanup (#27)
868d847 - Return error when get_ranges_of_device_sample_rate gives an empty vector (#30)

Differential Revision: https://phabricator.services.mozilla.com/D57385

--HG--
extra : source : e778231b145d37240127d209643ec4ecd7e5ea9b
  • Loading branch information
ChunMinChang committed Dec 17, 2019
1 parent 02ff9c4 commit 0b90398
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "5fcbd99e1b7356be1efcdc41654d495bd4c71c8c"
rev = "868d847c2e95096b6eec629dfed77ef363363ecb"

[source.crates-io]
replace-with = "vendored-sources"
Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion third_party/rust/cubeb-coreaudio/.cargo-checksum.json
Original file line number Diff line number Diff line change
@@ -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":"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}
{"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}
20 changes: 11 additions & 9 deletions third_party/rust/cubeb-coreaudio/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1490,10 +1490,16 @@ fn get_channel_count(devid: AudioObjectID, devtype: DeviceType) -> Result<u32> {
fn get_range_of_sample_rates(
devid: AudioObjectID,
devtype: DeviceType,
) -> std::result::Result<(f64, f64), OSStatus> {
) -> 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"));
}
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;
Expand Down Expand Up @@ -3221,7 +3227,7 @@ impl<'ctx> AudioUnitStream<'ctx> {
)
}

fn notify_state_changed(&mut self, state: State) {
fn notify_state_changed(&self, state: State) {
if self.state_callback.is_none() {
return;
}
Expand Down Expand Up @@ -3275,7 +3281,6 @@ 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
})?;
}
Expand All @@ -3288,7 +3293,6 @@ 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
})?;

Expand All @@ -3305,15 +3309,13 @@ 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| {
cubeb_log!(
"({:p}) Second stream reinit failed.",
self.core_stream_data.stm_ptr
);
self.core_stream_data.close();
e
})?;
}
Expand All @@ -3330,7 +3332,6 @@ impl<'ctx> AudioUnitStream<'ctx> {
"({:p}) Start audiounit failed.",
self.core_stream_data.stm_ptr
);
self.core_stream_data.close();
e
})?;
}
Expand Down Expand Up @@ -3365,6 +3366,7 @@ 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.",
Expand Down
2 changes: 1 addition & 1 deletion toolkit/library/rust/shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "5fcbd99e1b7356be1efcdc41654d495bd4c71c8c", optional = true }
cubeb-coreaudio = { git = "https://github.com/ChunMinChang/cubeb-coreaudio-rs", rev = "868d847c2e95096b6eec629dfed77ef363363ecb", 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" }
Expand Down

0 comments on commit 0b90398

Please sign in to comment.