This repository has been archived by the owner on Aug 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1601859 - Vendor cubeb-coreaudio. r=padenot
This technically breaks mach vendor rust because of the missing licenses, but this will be fixed subsequently. Differential Revision: https://phabricator.services.mozilla.com/D56160
- Loading branch information
Showing
45 changed files
with
6,443 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
media/libcubeb/cubeb-coreaudio-rs/src/backend/property_address.rs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"files":{"Cargo.toml":"077906135ef930990c17a944953291db52f5e2e178cad992872228f6dc35d263","src/aggregate_device.rs":"7d2bd5f5fd7f3d008ebb69ad81f522ca0cb73db6d7b3e50ed1a63ea26ff721f4","src/audio_object.rs":"df10160d9fd83a2c23a49e69b78d39db3a9d6389607df6acfc05821293b6af5f","src/audio_unit.rs":"bc743a1b8033ab5459520c75d7f5230d24cda5ea1198a5b4e1594256af308f47","src/cf_mutable_dict.rs":"fc42edd270c6dfb02f123214d2d8e487bbd62b5bd923b71eec13190fd0104d2a","src/dispatch.rs":"c3d43571f610cb8524ef49b5928da8363651507bb2ccec443be58c8688e111cb","src/lib.rs":"bcc559d69ef6ed0cbea5b2a36fec89d8c011eb9da70e2f26c00f881ad97a2546","src/string.rs":"ddce19b0f0e6aceb64fa96d2f15f6b191051255f58b340737028fb464087d4e1"},"package":null} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"files":{".editorconfig":"4e53b182bcc78b83d7e1b5c03efa14d22d4955c4ed2514d1ba4e99c1eb1a50ba",".travis.yml":"bea421508af5f4d00b941866dae0ae7d94a51b9276688a7f626686e8ed8fbbf3","Cargo.toml":"208c7d2c2240a1e38070313a981f61c72f81a017faf93d5ca350e0fae3a35df4","LICENSE":"6e6f56aff5bbf3cbc60747e152fb1a719bd0716aaf6d711c554f57d92e96297c","README.md":"72d8a890d6bda3cdba393432e5ae2018a385980785ebb2b96e9c3f82a48a1b59","run_tests.sh":"871864068903c37b04857f3509361f93fbbcf2b81d74eae5715ac2b451458813","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":"7b57ec50f24cffbacd323162b6b9357c276c151e2844c8e32fbe779b18ef3179","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":"e098dafaeedd7fbbf58378c2e74e7a245dba1cf8832695c1b08932a669131e44","src/backend/tests/device_property.rs":"b1a9ae79aa5b9a3f180040d0ef0954b134680d586882d2062c5e017b555bff57","src/backend/tests/interfaces.rs":"01fc2d54ddb50f014a44f9c137f078645738bcc81e48140a3e7ae68e18a61b6b","src/backend/tests/manual.rs":"066a7d981dc02d7a3fd83486b51e27ea1c9223496167ccb23a6478fde073e882","src/backend/tests/mod.rs":"8dba770023d7f9c4228f0e11915347f0e07da5fd818e3ee4478c4b197af9aa2a","src/backend/tests/parallel.rs":"f9e1883660d6146b6e5075806561f5f689810e25c5e7764dfd28c9b939821a49","src/backend/tests/tone.rs":"16150438317ce501986734167b5fb97bfec567228acbcd8f3b4c4484c22f29e0","src/backend/tests/utils.rs":"eb552657e68e67b8a60d04ad1bbb46cd1401bcafa27d383dccf4db141c8089c5","src/backend/utils.rs":"ee77bc266d672d3d9e23eb3290c1f897687394c6e459338804a17433380a6fd2","src/capi.rs":"61f8f0c4373adaefba1eb6e7084687e83a10136db96438bc35884327668e411f","src/lib.rs":"1ff4b738ed194061fca4ff745f847dea4de4e7a4fa1f898e7b4ad5e70c62386d","todo.md":"a66296c220cad24d08ee780308007a702f7e421edf0bb60464c3ce8feeda1882"},"package":null} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
language: rust | ||
rust: | ||
- stable | ||
- beta | ||
- nightly | ||
os: | ||
- osx | ||
before_script: | ||
- rustc --version | ||
- cargo --version | ||
script: | ||
- cargo build --verbose | ||
- sh run_tests.sh |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# cubeb-coreaudio-rs | ||
|
||
[](https://travis-ci.org/ChunMinChang/cubeb-coreaudio-rs) | ||
|
||
*Rust* implementation of [Cubeb][cubeb] on [the MacOS platform][cubeb-au]. | ||
|
||
## Current Goals | ||
- Keep refactoring the implementation until it looks rusty! (it's translated from C at first.) | ||
- Check the [todo list][todo] first | ||
|
||
## Status | ||
|
||
The code is currently tested in the _Firefox Nightly_ under a _perf_. | ||
|
||
- Try it: | ||
- Open `about:config` | ||
- Add a perf `media.cubeb.backend` with string `audiounit-rust` | ||
- Restart Firefox Nightly | ||
- Open `about:support` | ||
- Check if the `Audio Backend` in `Media` section is `audiounit-rust` or not | ||
- Retart Firefox Nightly again if it's not. | ||
|
||
## Test | ||
Please run `sh run_tests.sh`. | ||
|
||
Some tests cannot be run in parallel. | ||
They may operate the same device at the same time, | ||
or indirectly fire some system events that are listened by some tests. | ||
|
||
The tests that may affect others are marked `#[ignore]`. | ||
They will be run by `cargo test ... -- --ignored ...` | ||
after finishing normal tests. | ||
Most of the tests are executed in `run_tests.sh`. | ||
Only those tests commented with *FIXIT* are left. | ||
|
||
### Device Switching | ||
The system default device will be changed during our tests. | ||
All the available devices will take turns being the system default device. | ||
However, after finishing the tests, the default device will be set to the original one. | ||
The sounds in the tests should be able to continue whatever the system default device is. | ||
|
||
### Device Plugging/Unplugging | ||
We implement APIs simulating plugging or unplugging a device | ||
by adding or removing an aggregate device programmatically. | ||
It's used to verify our callbacks for minitoring the system devices work. | ||
|
||
### Manual Test | ||
- Output devices switching | ||
- `$ cargo test test_switch_output_device -- --ignored --nocapture` | ||
- Enter `s` to switch output devices | ||
- Enter `q` to finish test | ||
- Device change events listener | ||
- `$ cargo test test_add_then_remove_listeners -- --ignored --nocapture` | ||
- Plug/Unplug devices or switch input/output devices to see events log. | ||
- Device collection change | ||
- `cargo test test_device_collection_change -- --ignored --nocapture` | ||
- Plug/Unplug devices to see events log. | ||
|
||
## TODO | ||
See [todo list][todo] | ||
|
||
## Issues | ||
- Atomic: | ||
- We need atomic type around `f32` but there is no this type in the stardard Rust | ||
- Using [atomic-rs](https://github.com/Amanieu/atomic-rs) to do this. | ||
- No guarantee on `audiounit_set_channel_layout` | ||
- This call doesn't work all the times | ||
- Returned `NO_ERR` doesn't guarantee the layout is set to the one we want | ||
- The layouts on some devices won't be changed even no errors are returned, | ||
e.g., we can set _stereo_ layout to a _4-channels aggregate device_ with _QUAD_ layout | ||
(created by Audio MIDI Setup) without any error. However, the layout | ||
of this 4-channels aggregate device is still QUAD after setting it without error | ||
- Another weird thing is that we will get a `kAudioUnitErr_InvalidPropertyValue` | ||
if we set the layout to _QUAD_. It's the same layout as its original one but it cannot be set! | ||
- `kAudioDevicePropertyBufferFrameSize` cannot be set when another stream using the same device with smaller buffer size is active. See [here][chg-buf-sz] for details. | ||
|
||
### Test issues | ||
- Fail to run tests that depend on `AggregateDevice::create_blank_device` with the tests that work with the device event listeners | ||
- The `AggregateDevice::create_blank_device` will add an aggregate device to the system and fire the device-change events indirectly. | ||
- `TestDeviceSwitcher` cannot work when there is an alive full-duplex stream | ||
- An aggregate device will be created for a duplex stream when its input and output devices are different. | ||
- `TestDeviceSwitcher` will cached the available devices, upon it's created, as the candidates for default device | ||
- Hence the created aggregate device may be cached in `TestDeviceSwitcher` | ||
- If the aggregate device is destroyed (when the destroying the duplex stream created it) but the `TestDeviceSwitcher` is still working, | ||
it will set a destroyed device as the default device | ||
- See details in [device_change.rs](src/backend/tests/device_change.rs) | ||
|
||
## Branches | ||
- [trailblazer][trailblazer]: Main branch | ||
- [plain-translation-from-c][from-c]: The code is rewritten from C code on a line-by-line basis | ||
- [ocs-disposal][ocs-disposal]: The first version that replace our custom mutex by Rust Mutex | ||
|
||
[cubeb]: https://github.com/kinetiknz/cubeb "Cross platform audio library" | ||
[cubeb-au]: https://github.com/kinetiknz/cubeb/blob/master/src/cubeb_audiounit.cpp "Cubeb AudioUnit" | ||
|
||
[chg-buf-sz]: https://cs.chromium.org/chromium/src/media/audio/mac/audio_manager_mac.cc?l=982-989&rcl=0207eefb445f9855c2ed46280cb835b6f08bdb30 "issue on changing buffer size" | ||
|
||
[todo]: todo.md | ||
|
||
[bmo1572273]: https://bugzilla.mozilla.org/show_bug.cgi?id=1572273 | ||
[bmo1572273-c13]: https://bugzilla.mozilla.org/show_bug.cgi?id=1572273#c13 | ||
|
||
[from-c]: https://github.com/ChunMinChang/cubeb-coreaudio-rs/tree/plain-translation-from-c | ||
[ocs-disposal]: https://github.com/ChunMinChang/cubeb-coreaudio-rs/tree/ocs-disposal | ||
[trailblazer]: https://github.com/ChunMinChang/cubeb-coreaudio-rs/tree/trailblazer |
Oops, something went wrong.