Skip to content

Commit

Permalink
Bug 1761392 - mach vendor rust. r=cubeb-reviewers,chunmin
Browse files Browse the repository at this point in the history
  • Loading branch information
padenot committed Mar 25, 2022
1 parent 4d7288f commit cf857a0
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ rev = "df4dc0288b07b865440f4c7e41ca49ca9ccffc63"
[source."https://github.com/mozilla/cubeb-coreaudio-rs"]
git = "https://github.com/mozilla/cubeb-coreaudio-rs"
replace-with = "vendored-sources"
rev = "b313a83c0a0becf6115f6002510081a3537562ee"
rev = "e012b2151fb6f0ffd50e91baa7756e77a3c416d9"

[source."https://github.com/mozilla/audioipc-2"]
git = "https://github.com/mozilla/audioipc-2"
Expand Down
4 changes: 2 additions & 2 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":{".circleci/config.yml":"7f3dc865105ca8f33965a7958b1fe2e627ae2d5a703f3b2a4ab6e2e796018597",".editorconfig":"4e53b182bcc78b83d7e1b5c03efa14d22d4955c4ed2514d1ba4e99c1eb1a50ba",".githooks/pre-push":"8b8b26544cd56f54c0c33812551f786bb25cb08c86dbfeb6bf3daad881c826a1",".github/workflows/test.yml":"aa1998a3b104ad131805ca3513832cef3f65300192824f8b1efc9a5a0cc108f6",".travis.yml":"dc07bac53f70f16c9bdf52264bdc58500ae6018c1b4c567bc7642f6b4ca3cc35","Cargo.toml":"4671b9a0fbf47773cf01e40592ac5b5fe5cd93722f425f249e6c8b432ce3871c","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":"cac9a7d588c2be0efa842c15d24c8cf0573bc9f9d73011662ba764dc9f6245e8","run_sanitizers.sh":"8828c73439dfd540cd21fc713c4a1011ec05baca6f282f285743f310ace39563","run_tests.sh":"916a7ae4a406d2274417d6eca939a878db5adcb6144e5680d9d148bf90178f1c","src/backend/aggregate_device.rs":"6faa5ed4f4ab378fd452105a655cd64d2459edec0cf9b3d70375df22cd79c7e8","src/backend/auto_release.rs":"050fdcee74cf46b9a8a85a877e166d72a853d33220f59cf734cbb6ea09daa441","src/backend/buffer_manager.rs":"12490043d978d3902927e739cf33905a3c756888a8ff991c2bae4c3792db02fd","src/backend/device_property.rs":"2a63837b98b9b6bfb314b4aa6dce919412b71e13e18c7b8f3477aa1482f70b29","src/backend/mixer.rs":"949c34927ba72b3365bc733a63b2f7950aef707ee08363f97242a4de6b7d4818","src/backend/mod.rs":"00b834b99938f8140cf8f392a8a536226f1d3f4991e3ed61ba48958e4a270c08","src/backend/resampler.rs":"8641c672d00f77be287d64f6cd4a2b2cd36f8630e2ded1eff6b39834b1b7ddc3","src/backend/tests/aggregate_device.rs":"d0b863fb67d3533501b3266f9fa944ec872efb02a457728b2fe7e92c47abb261","src/backend/tests/api.rs":"a6cd4e7c89be3fa820402714bbd1d792404fe2915928f70d626f887c9e2d7685","src/backend/tests/backlog.rs":"3b189a7e036543c467cc242af0ed3332721179ee2b1c8847a6db563546f1ac52","src/backend/tests/device_change.rs":"97555244a8081251f1447c6a677609d1e91f33c9c0f4fb3f8a4082005c68ae0c","src/backend/tests/device_property.rs":"373f76d3bee83b263db3f02be3b94b408bdf852d84e4b5153273fda34b11a374","src/backend/tests/interfaces.rs":"b48d646b6ea06ca1bf7ce4b0ada59a164bc094e40b0cd66bb63b269f9032b022","src/backend/tests/manual.rs":"8d485a6666a3f4518b03e39dab80bf2acfd760af2d2f43bad99023cb135b38ca","src/backend/tests/mod.rs":"8dba770023d7f9c4228f0e11915347f0e07da5fd818e3ee4478c4b197af9aa2a","src/backend/tests/parallel.rs":"f9e1883660d6146b6e5075806561f5f689810e25c5e7764dfd28c9b939821a49","src/backend/tests/tone.rs":"779cc14fc2a362bf7f26ce66ad70c0639501176175655a99b7fefb3c59d56c7a","src/backend/tests/utils.rs":"38f78f79758d43ca1b8ec41dd4b918c72eaacc4da7e94cf3b2629ba621497e55","src/backend/utils.rs":"6c3ffbcd602e6cc9f56deb9ecb07b2eef2e6f074ef924178e466f380aae5c595","src/capi.rs":"21b66b70545bf04ec719928004d1d9adb45b24ced51288f5b2993d79aaf78f5f","src/lib.rs":"5e586d45cd6b3722f0a6736d9252593299269817a153eef1930a5fb9bfbb56f5","todo.md":"e79e442241c5346737e7d52a9a7a1f824d2657855e8c44b42840f85956d8bfe7"},"package":null}
{"files":{".circleci/config.yml":"7f3dc865105ca8f33965a7958b1fe2e627ae2d5a703f3b2a4ab6e2e796018597",".editorconfig":"4e53b182bcc78b83d7e1b5c03efa14d22d4955c4ed2514d1ba4e99c1eb1a50ba",".githooks/pre-push":"8b8b26544cd56f54c0c33812551f786bb25cb08c86dbfeb6bf3daad881c826a1",".github/workflows/test.yml":"aa1998a3b104ad131805ca3513832cef3f65300192824f8b1efc9a5a0cc108f6",".travis.yml":"dc07bac53f70f16c9bdf52264bdc58500ae6018c1b4c567bc7642f6b4ca3cc35","Cargo.toml":"4671b9a0fbf47773cf01e40592ac5b5fe5cd93722f425f249e6c8b432ce3871c","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":"cac9a7d588c2be0efa842c15d24c8cf0573bc9f9d73011662ba764dc9f6245e8","run_sanitizers.sh":"8828c73439dfd540cd21fc713c4a1011ec05baca6f282f285743f310ace39563","run_tests.sh":"916a7ae4a406d2274417d6eca939a878db5adcb6144e5680d9d148bf90178f1c","src/backend/aggregate_device.rs":"6faa5ed4f4ab378fd452105a655cd64d2459edec0cf9b3d70375df22cd79c7e8","src/backend/auto_release.rs":"050fdcee74cf46b9a8a85a877e166d72a853d33220f59cf734cbb6ea09daa441","src/backend/buffer_manager.rs":"12490043d978d3902927e739cf33905a3c756888a8ff991c2bae4c3792db02fd","src/backend/device_property.rs":"2a63837b98b9b6bfb314b4aa6dce919412b71e13e18c7b8f3477aa1482f70b29","src/backend/mixer.rs":"949c34927ba72b3365bc733a63b2f7950aef707ee08363f97242a4de6b7d4818","src/backend/mod.rs":"a4ea99bb92e42471db44801cec83833fa17c1b10bb606366e3cfdadaff4325dd","src/backend/resampler.rs":"8641c672d00f77be287d64f6cd4a2b2cd36f8630e2ded1eff6b39834b1b7ddc3","src/backend/tests/aggregate_device.rs":"d0b863fb67d3533501b3266f9fa944ec872efb02a457728b2fe7e92c47abb261","src/backend/tests/api.rs":"a6cd4e7c89be3fa820402714bbd1d792404fe2915928f70d626f887c9e2d7685","src/backend/tests/backlog.rs":"3b189a7e036543c467cc242af0ed3332721179ee2b1c8847a6db563546f1ac52","src/backend/tests/device_change.rs":"97555244a8081251f1447c6a677609d1e91f33c9c0f4fb3f8a4082005c68ae0c","src/backend/tests/device_property.rs":"373f76d3bee83b263db3f02be3b94b408bdf852d84e4b5153273fda34b11a374","src/backend/tests/interfaces.rs":"b48d646b6ea06ca1bf7ce4b0ada59a164bc094e40b0cd66bb63b269f9032b022","src/backend/tests/manual.rs":"8d485a6666a3f4518b03e39dab80bf2acfd760af2d2f43bad99023cb135b38ca","src/backend/tests/mod.rs":"8dba770023d7f9c4228f0e11915347f0e07da5fd818e3ee4478c4b197af9aa2a","src/backend/tests/parallel.rs":"f9e1883660d6146b6e5075806561f5f689810e25c5e7764dfd28c9b939821a49","src/backend/tests/tone.rs":"779cc14fc2a362bf7f26ce66ad70c0639501176175655a99b7fefb3c59d56c7a","src/backend/tests/utils.rs":"38f78f79758d43ca1b8ec41dd4b918c72eaacc4da7e94cf3b2629ba621497e55","src/backend/utils.rs":"6c3ffbcd602e6cc9f56deb9ecb07b2eef2e6f074ef924178e466f380aae5c595","src/capi.rs":"21b66b70545bf04ec719928004d1d9adb45b24ced51288f5b2993d79aaf78f5f","src/lib.rs":"5e586d45cd6b3722f0a6736d9252593299269817a153eef1930a5fb9bfbb56f5","todo.md":"e79e442241c5346737e7d52a9a7a1f824d2657855e8c44b42840f85956d8bfe7"},"package":null}
37 changes: 35 additions & 2 deletions third_party/rust/cubeb-coreaudio/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2660,7 +2660,6 @@ impl<'ctx> CoreStreamData<'ctx> {
let params = unsafe {
let mut p = *self.output_stream_params.as_ptr();
p.channels = output_hw_desc.mChannelsPerFrame;
p.rate = output_hw_desc.mSampleRate as _;
StreamParams::from(p)
};

Expand Down Expand Up @@ -3287,6 +3286,40 @@ impl<'ctx> AudioUnitStream<'ctx> {

self.core_stream_data.close();

// Use the new default device if this stream was set to follow the output device.
if self.core_stream_data.has_output()
&& self
.core_stream_data
.output_device
.flags
.contains(device_flags::DEV_SELECTED_DEFAULT)
{
self.core_stream_data.output_device = create_device_info(kAudioObjectUnknown, DeviceType::OUTPUT).map_err(|e| {
cubeb_log!(
"({:p}) Create output device info failed. This can happen when last media device is unplugged",
self.core_stream_data.stm_ptr
);
e
})?;
}

// Likewise, for the input seid
if self.core_stream_data.has_input()
&& self
.core_stream_data
.input_device
.flags
.contains(device_flags::DEV_SELECTED_DEFAULT)
{
self.core_stream_data.input_device = create_device_info(kAudioObjectUnknown, DeviceType::INPUT).map_err(|e| {
cubeb_log!(
"({:p}) Create input device info failed. This can happen when last media device is unplugged",
self.core_stream_data.stm_ptr
);
e
})?;
}

self.core_stream_data.setup().map_err(|e| {
cubeb_log!("({:p}) Setup failed.", self.core_stream_data.stm_ptr);
e
Expand Down Expand Up @@ -3527,7 +3560,7 @@ impl<'ctx> StreamOps for AudioUnitStream<'ctx> {
if hw_rate == user_rate {
Ok(frames)
} else {
Ok(frames * (user_rate / hw_rate))
Ok((frames * user_rate) / hw_rate)
}
} else {
Err(Error::error())
Expand Down

0 comments on commit cf857a0

Please sign in to comment.