Backed out changeset ee5e8cc2e91d (bug 1874789) as requested, for causing audio issues. CLOSED TREE

This commit is contained in:
Natalia Csoregi 2024-02-15 18:05:15 +02:00
Родитель 0cd492afa4
Коммит 73439ecca3
7 изменённых файлов: 56 добавлений и 30 удалений

Просмотреть файл

@ -70,9 +70,9 @@ git = "https://github.com/mozilla/audioipc"
rev = "596bdb7fbb5745ea415726e16bd497e6c850a540" rev = "596bdb7fbb5745ea415726e16bd497e6c850a540"
replace-with = "vendored-sources" replace-with = "vendored-sources"
[source."git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=d777208b31b9895cdbbc6d254ecb039a0d9c35c1"] [source."git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=4ba39ca14bbb5bb0274843701cd958717a0fe293"]
git = "https://github.com/mozilla/cubeb-coreaudio-rs" git = "https://github.com/mozilla/cubeb-coreaudio-rs"
rev = "d777208b31b9895cdbbc6d254ecb039a0d9c35c1" rev = "4ba39ca14bbb5bb0274843701cd958717a0fe293"
replace-with = "vendored-sources" replace-with = "vendored-sources"
[source."git+https://github.com/mozilla/cubeb-pulse-rs?rev=8ff972c8e2ec1782ff262ac4071c0415e69b1367"] [source."git+https://github.com/mozilla/cubeb-pulse-rs?rev=8ff972c8e2ec1782ff262ac4071c0415e69b1367"]

4
Cargo.lock сгенерированный
Просмотреть файл

@ -899,7 +899,7 @@ dependencies = [
[[package]] [[package]]
name = "coreaudio-sys-utils" name = "coreaudio-sys-utils"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=d777208b31b9895cdbbc6d254ecb039a0d9c35c1#d777208b31b9895cdbbc6d254ecb039a0d9c35c1" source = "git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=4ba39ca14bbb5bb0274843701cd958717a0fe293#4ba39ca14bbb5bb0274843701cd958717a0fe293"
dependencies = [ dependencies = [
"core-foundation-sys", "core-foundation-sys",
"coreaudio-sys", "coreaudio-sys",
@ -1110,7 +1110,7 @@ dependencies = [
[[package]] [[package]]
name = "cubeb-coreaudio" name = "cubeb-coreaudio"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=d777208b31b9895cdbbc6d254ecb039a0d9c35c1#d777208b31b9895cdbbc6d254ecb039a0d9c35c1" source = "git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=4ba39ca14bbb5bb0274843701cd958717a0fe293#4ba39ca14bbb5bb0274843701cd958717a0fe293"
dependencies = [ dependencies = [
"atomic", "atomic",
"audio-mixer", "audio-mixer",

Просмотреть файл

@ -1296,7 +1296,7 @@ who = "David Cook <dcook@divviup.org>"
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
user-id = 213776 # divviup-github-automation user-id = 213776 # divviup-github-automation
start = "2020-09-28" start = "2020-09-28"
end = "2025-02-12" end = "2024-03-23"
[[audits.isrg.audits.base64]] [[audits.isrg.audits.base64]]
who = "Tim Geoghegan <timg@letsencrypt.org>" who = "Tim Geoghegan <timg@letsencrypt.org>"

Просмотреть файл

@ -1 +1 @@
{"files":{".circleci/config.yml":"7f3dc865105ca8f33965a7958b1fe2e627ae2d5a703f3b2a4ab6e2e796018597",".editorconfig":"4e53b182bcc78b83d7e1b5c03efa14d22d4955c4ed2514d1ba4e99c1eb1a50ba",".githooks/pre-push":"8b8b26544cd56f54c0c33812551f786bb25cb08c86dbfeb6bf3daad881c826a1",".github/workflows/test.yml":"aa1998a3b104ad131805ca3513832cef3f65300192824f8b1efc9a5a0cc108f6",".travis.yml":"dc07bac53f70f16c9bdf52264bdc58500ae6018c1b4c567bc7642f6b4ca3cc35","Cargo.toml":"d7e757e664c23fae52028f1dfc5917f92523c08702e3a1f95e1fd38ed714416c","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":"d717e598c96e4911d9494b18382d6bd3a8d5038b7d68d3166ad4336e237a97d8","run_sanitizers.sh":"84e93a0da137803018f37403511e8c92760be730426bf6cea34419d93d1a7ff8","run_tests.sh":"916a7ae4a406d2274417d6eca939a878db5adcb6144e5680d9d148bf90178f1c","src/backend/aggregate_device.rs":"43511107ba2a75a19340ac663c981362ca1b75b679b6c295d88b5035bd7e3619","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":"e703172b2ef9bf6e55217c4f0ac96dec29f37cab191f5969f728909d1a95ed6d","src/backend/resampler.rs":"48bf8f56ae8d60dbabca6417b768000619abee8731ac3902164b45651ac08a4d","src/backend/tests/aggregate_device.rs":"e3f94e118e1dd47941fbba4417de40bddc4254d9f06b1e938f58d8f1aa566a5c","src/backend/tests/api.rs":"cd7e7551e2e82b19da883621a494d2a6779c373f3ff2d12ee52fae8efec1e7b8","src/backend/tests/backlog.rs":"3b189a7e036543c467cc242af0ed3332721179ee2b1c8847a6db563546f1ac52","src/backend/tests/device_change.rs":"f68c2eaa55c3ec2a58894832fbca1e2a2e79e740b145f76a0f45452af465a934","src/backend/tests/device_property.rs":"ea0be5f8834be494cb33f854ce9d334b5763dc5287f949bcb4bd025d8a8b2d3b","src/backend/tests/interfaces.rs":"2f192d08a5b2cbf678e0fea38b7061b1f0e83aa6b8f443bd92b70fee67c35516","src/backend/tests/manual.rs":"4a1634e86beb145d2703722a8be057a762953241329c82ee09acf7dc0f0d9d0c","src/backend/tests/mod.rs":"8dba770023d7f9c4228f0e11915347f0e07da5fd818e3ee4478c4b197af9aa2a","src/backend/tests/parallel.rs":"59632744e70616ab7037facb0787db339b96800c8cc397d203241548c5cfb7f5","src/backend/tests/tone.rs":"779cc14fc2a362bf7f26ce66ad70c0639501176175655a99b7fefb3c59d56c7a","src/backend/tests/utils.rs":"efb8b3709aff7ed5e2923566084de3e0709f3bd9c18a04f3310d7a3b86fa4b71","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":"aa1998a3b104ad131805ca3513832cef3f65300192824f8b1efc9a5a0cc108f6",".travis.yml":"dc07bac53f70f16c9bdf52264bdc58500ae6018c1b4c567bc7642f6b4ca3cc35","Cargo.toml":"d7e757e664c23fae52028f1dfc5917f92523c08702e3a1f95e1fd38ed714416c","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":"d717e598c96e4911d9494b18382d6bd3a8d5038b7d68d3166ad4336e237a97d8","run_sanitizers.sh":"84e93a0da137803018f37403511e8c92760be730426bf6cea34419d93d1a7ff8","run_tests.sh":"916a7ae4a406d2274417d6eca939a878db5adcb6144e5680d9d148bf90178f1c","src/backend/aggregate_device.rs":"43511107ba2a75a19340ac663c981362ca1b75b679b6c295d88b5035bd7e3619","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":"4f07743a46a4b908c9e23b31d0bc8f3a0983b943e0bb824b9154272b2673ae90","src/backend/resampler.rs":"48bf8f56ae8d60dbabca6417b768000619abee8731ac3902164b45651ac08a4d","src/backend/tests/aggregate_device.rs":"e3f94e118e1dd47941fbba4417de40bddc4254d9f06b1e938f58d8f1aa566a5c","src/backend/tests/api.rs":"cd7e7551e2e82b19da883621a494d2a6779c373f3ff2d12ee52fae8efec1e7b8","src/backend/tests/backlog.rs":"3b189a7e036543c467cc242af0ed3332721179ee2b1c8847a6db563546f1ac52","src/backend/tests/device_change.rs":"f68c2eaa55c3ec2a58894832fbca1e2a2e79e740b145f76a0f45452af465a934","src/backend/tests/device_property.rs":"ea0be5f8834be494cb33f854ce9d334b5763dc5287f949bcb4bd025d8a8b2d3b","src/backend/tests/interfaces.rs":"2f192d08a5b2cbf678e0fea38b7061b1f0e83aa6b8f443bd92b70fee67c35516","src/backend/tests/manual.rs":"0c1bbd9b6137bbc484974c4bf7ea965872b8f52f86055f07916b85a3d715e0a6","src/backend/tests/mod.rs":"8dba770023d7f9c4228f0e11915347f0e07da5fd818e3ee4478c4b197af9aa2a","src/backend/tests/parallel.rs":"59632744e70616ab7037facb0787db339b96800c8cc397d203241548c5cfb7f5","src/backend/tests/tone.rs":"779cc14fc2a362bf7f26ce66ad70c0639501176175655a99b7fefb3c59d56c7a","src/backend/tests/utils.rs":"efb8b3709aff7ed5e2923566084de3e0709f3bd9c18a04f3310d7a3b86fa4b71","src/backend/utils.rs":"6c3ffbcd602e6cc9f56deb9ecb07b2eef2e6f074ef924178e466f380aae5c595","src/capi.rs":"21b66b70545bf04ec719928004d1d9adb45b24ced51288f5b2993d79aaf78f5f","src/lib.rs":"5e586d45cd6b3722f0a6736d9252593299269817a153eef1930a5fb9bfbb56f5","todo.md":"efc1f012eb9a331a040cad4ac03aa79307f25885f71b6fb38f3ad7af8d7d515c"},"package":null}

Просмотреть файл

@ -35,9 +35,9 @@ use self::utils::*;
use atomic; use atomic;
use backend::ringbuf::RingBuffer; use backend::ringbuf::RingBuffer;
use cubeb_backend::{ use cubeb_backend::{
ffi, ChannelLayout, Context, ContextOps, DeviceCollectionRef, DeviceId, DeviceRef, DeviceType, ffi, Context, ContextOps, DeviceCollectionRef, DeviceId, DeviceRef, DeviceType, Error,
Error, InputProcessingParams, Ops, Result, SampleFormat, State, Stream, StreamOps, InputProcessingParams, Ops, Result, SampleFormat, State, Stream, StreamOps, StreamParams,
StreamParams, StreamParamsRef, StreamPrefs, StreamParamsRef, StreamPrefs,
}; };
use mach::mach_time::{mach_absolute_time, mach_timebase_info}; use mach::mach_time::{mach_absolute_time, mach_timebase_info};
use std::cmp; use std::cmp;
@ -311,7 +311,8 @@ fn set_input_processing_params(unit: AudioUnit, params: InputProcessingParams) -
let aec = params.contains(InputProcessingParams::ECHO_CANCELLATION); let aec = params.contains(InputProcessingParams::ECHO_CANCELLATION);
let ns = params.contains(InputProcessingParams::NOISE_SUPPRESSION); let ns = params.contains(InputProcessingParams::NOISE_SUPPRESSION);
// See the comment in supported_input_processing_params on why we don't expose AGC to clients. // We don't use AGC, but keep it here for reference.
// See the comment in supported_input_processing_params.
let agc = params.contains(InputProcessingParams::AUTOMATIC_GAIN_CONTROL); let agc = params.contains(InputProcessingParams::AUTOMATIC_GAIN_CONTROL);
assert!(!agc); assert!(!agc);
@ -323,10 +324,7 @@ fn set_input_processing_params(unit: AudioUnit, params: InputProcessingParams) -
return Err(Error::error()); return Err(Error::error());
} }
// Always use AGC to limit the signal, as it may be far out of bounds without AGC, let agc = u32::from(agc);
// resulting in clipping. This has been observed with an Apple Studio Display being
// used for both input and output.
let agc = u32::from(true);
let r = audio_unit_set_property( let r = audio_unit_set_property(
unit, unit,
kAUVoiceIOProperty_VoiceProcessingEnableAGC, kAUVoiceIOProperty_VoiceProcessingEnableAGC,
@ -2242,7 +2240,7 @@ impl ContextOps for AudioUnitContext {
// The VoiceProcessingIO AudioUnit has the // The VoiceProcessingIO AudioUnit has the
// kAUVoiceIOProperty_VoiceProcessingEnableAGC property to enable AGC on // kAUVoiceIOProperty_VoiceProcessingEnableAGC property to enable AGC on
// the input signal, but some simple manual tests on MacOS 14.0 suggest // the input signal, but some simple manual tests on MacOS 14.0 suggest
// it doesn't amplify a weak signal. // it doesn't have any effect.
Ok(InputProcessingParams::ECHO_CANCELLATION | InputProcessingParams::NOISE_SUPPRESSION) Ok(InputProcessingParams::ECHO_CANCELLATION | InputProcessingParams::NOISE_SUPPRESSION)
} }
fn enumerate_devices( fn enumerate_devices(
@ -2937,7 +2935,8 @@ impl<'ctx> CoreStreamData<'ctx> {
let params = unsafe { let params = unsafe {
let mut p = *self.input_stream_params.as_ptr(); let mut p = *self.input_stream_params.as_ptr();
p.channels = if using_voice_processing_unit { p.channels = if using_voice_processing_unit {
// VPIO is always MONO. // With VPIO, stereo input devices configured for stereo have been observed to
// spit out only a single mono channel.
1 1
} else { } else {
input_hw_desc.mChannelsPerFrame input_hw_desc.mChannelsPerFrame
@ -3055,6 +3054,9 @@ impl<'ctx> CoreStreamData<'ctx> {
out_dev_info out_dev_info
); );
let device_channel_count =
get_channel_count(self.output_device.id, DeviceType::OUTPUT).unwrap_or(0);
cubeb_log!( cubeb_log!(
"({:p}) Opening output side: rate {}, channels {}, format {:?}, layout {:?}, prefs {:?}, latency in frames {}, voice processing {}.", "({:p}) Opening output side: rate {}, channels {}, format {:?}, layout {:?}, prefs {:?}, latency in frames {}, voice processing {}.",
self.stm_ptr, self.stm_ptr,
@ -3091,10 +3093,9 @@ impl<'ctx> CoreStreamData<'ctx> {
output_hw_desc output_hw_desc
); );
// In some cases with (other streams using) VPIO the stream format's mChannelsPerFrame // In some cases with VPIO the stream format's mChannelsPerFrame is higher than
// is higher than expected. Use get_channel_count as source of truth. // expected. Use get_channel_count as source of truth.
output_hw_desc.mChannelsPerFrame = output_hw_desc.mChannelsPerFrame = device_channel_count;
get_channel_count(self.output_device.id, DeviceType::OUTPUT).unwrap_or(0);
// This has been observed in the wild. // This has been observed in the wild.
if output_hw_desc.mChannelsPerFrame == 0 { if output_hw_desc.mChannelsPerFrame == 0 {
@ -3111,12 +3112,7 @@ impl<'ctx> CoreStreamData<'ctx> {
// channels will be appended at the end of the raw data given by the output callback. // channels will be appended at the end of the raw data given by the output callback.
let params = unsafe { let params = unsafe {
let mut p = *self.output_stream_params.as_ptr(); let mut p = *self.output_stream_params.as_ptr();
p.channels = if using_voice_processing_unit { p.channels = output_hw_desc.mChannelsPerFrame;
// VPIO is always MONO.
1
} else {
output_hw_desc.mChannelsPerFrame
};
if using_voice_processing_unit { if using_voice_processing_unit {
// VPIO will always use the sample rate of the input hw for both input and output, // VPIO will always use the sample rate of the input hw for both input and output,
// as reported to us. (We can override it but we cannot improve quality this way). // as reported to us. (We can override it but we cannot improve quality this way).
@ -3723,10 +3719,23 @@ impl<'ctx> CoreStreamData<'ctx> {
fn get_output_channel_layout(&self) -> Result<Vec<mixer::Channel>> { fn get_output_channel_layout(&self) -> Result<Vec<mixer::Channel>> {
self.debug_assert_is_on_stream_queue(); self.debug_assert_is_on_stream_queue();
assert!(!self.output_unit.is_null()); assert!(!self.output_unit.is_null());
if self.using_voice_processing_unit() { if !self.using_voice_processing_unit() {
return Ok(get_channel_order(ChannelLayout::MONO)); return get_channel_layout(self.output_unit);
} }
get_channel_layout(self.output_unit)
// The VoiceProcessingIO unit (as tried on MacOS 14) is known to not support
// kAudioUnitProperty_AudioChannelLayout queries, and to lie about
// kAudioDevicePropertyPreferredChannelLayout. If we're using
// VoiceProcessingIO, try standing up a regular AudioUnit and query that.
cubeb_log!(
"({:p}) get_output_channel_layout with a VoiceProcessingIO output unit. Trying a dedicated unit.",
self.stm_ptr
);
let mut dedicated_unit = create_audiounit(&self.output_device)?;
let res = get_channel_layout(dedicated_unit);
dispose_audio_unit(dedicated_unit);
dedicated_unit = ptr::null_mut();
res
} }
} }

Просмотреть файл

@ -338,6 +338,23 @@ fn test_stream_tester() {
params.set(InputProcessingParams::ECHO_CANCELLATION, true); params.set(InputProcessingParams::ECHO_CANCELLATION, true);
params.set(InputProcessingParams::NOISE_SUPPRESSION, true); params.set(InputProcessingParams::NOISE_SUPPRESSION, true);
} }
let mut agc = u32::from(false);
let mut size: usize = mem::size_of::<u32>();
assert_eq!(
audio_unit_get_property(
stm.core_stream_data.input_unit,
kAUVoiceIOProperty_VoiceProcessingEnableAGC,
kAudioUnitScope_Global,
AU_IN_BUS,
&mut agc,
&mut size,
),
NO_ERR
);
assert_eq!(size, mem::size_of::<u32>());
if agc == 1 {
params.set(InputProcessingParams::AUTOMATIC_GAIN_CONTROL, true);
}
} }
let mut done = false; let mut done = false;
while !done { while !done {

Просмотреть файл

@ -22,7 +22,7 @@ static_prefs = { path = "../../../../modules/libpref/init/static_prefs" }
profiler_helper = { path = "../../../../tools/profiler/rust-helper", optional = true } profiler_helper = { path = "../../../../tools/profiler/rust-helper", optional = true }
mozurl = { path = "../../../../netwerk/base/mozurl" } mozurl = { path = "../../../../netwerk/base/mozurl" }
webrender_bindings = { path = "../../../../gfx/webrender_bindings" } webrender_bindings = { path = "../../../../gfx/webrender_bindings" }
cubeb-coreaudio = { git = "https://github.com/mozilla/cubeb-coreaudio-rs", rev = "d777208b31b9895cdbbc6d254ecb039a0d9c35c1", optional = true } cubeb-coreaudio = { git = "https://github.com/mozilla/cubeb-coreaudio-rs", rev = "4ba39ca14bbb5bb0274843701cd958717a0fe293", optional = true }
cubeb-pulse = { git = "https://github.com/mozilla/cubeb-pulse-rs", rev="8ff972c8e2ec1782ff262ac4071c0415e69b1367", optional = true, features=["pulse-dlopen"] } cubeb-pulse = { git = "https://github.com/mozilla/cubeb-pulse-rs", rev="8ff972c8e2ec1782ff262ac4071c0415e69b1367", optional = true, features=["pulse-dlopen"] }
cubeb-sys = { version = "0.12.0", optional = true, features=["gecko-in-tree"] } cubeb-sys = { version = "0.12.0", optional = true, features=["gecko-in-tree"] }
audioipc2-client = { git = "https://github.com/mozilla/audioipc", rev = "596bdb7fbb5745ea415726e16bd497e6c850a540", optional = true } audioipc2-client = { git = "https://github.com/mozilla/audioipc", rev = "596bdb7fbb5745ea415726e16bd497e6c850a540", optional = true }