From 15679d2dba007bc9c601871d856cc9fc9e5575ec Mon Sep 17 00:00:00 2001 From: az Date: Fri, 9 Sep 2022 22:17:31 +0000 Subject: [PATCH] Bug 1789547 - Update cubeb-coreaudio to 0.10.1 r=kinetik,cubeb-reviewers Depends on D156631 Differential Revision: https://phabricator.services.mozilla.com/D156632 --- .cargo/config.in | 2 +- Cargo.lock | 4 +- .../rust/cubeb-coreaudio/.cargo-checksum.json | 2 +- third_party/rust/cubeb-coreaudio/Cargo.toml | 2 +- .../src/backend/buffer_manager.rs | 12 ++- .../rust/cubeb-coreaudio/src/backend/mixer.rs | 6 +- .../rust/cubeb-coreaudio/src/backend/mod.rs | 80 +++++++++++-------- .../src/backend/tests/interfaces.rs | 11 ++- toolkit/library/rust/shared/Cargo.toml | 2 +- 9 files changed, 76 insertions(+), 45 deletions(-) diff --git a/.cargo/config.in b/.cargo/config.in index 8ceb0682615f..d5292fa00357 100644 --- a/.cargo/config.in +++ b/.cargo/config.in @@ -40,7 +40,7 @@ rev = "1f1fe1e08e01a9a534ec7f079702a583a0899ce7" [source."https://github.com/mozilla/cubeb-coreaudio-rs"] git = "https://github.com/mozilla/cubeb-coreaudio-rs" replace-with = "vendored-sources" -rev = "44eca95823bb57e964cf7b6d9791ed2ccb4b2108" +rev = "ab933e7cbd569f79b37b540412a7990a5352dd66" [source."https://github.com/mozilla/audioipc"] git = "https://github.com/mozilla/audioipc" diff --git a/Cargo.lock b/Cargo.lock index 300f38629229..640c3d172eb6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -900,7 +900,7 @@ dependencies = [ [[package]] name = "coreaudio-sys-utils" version = "0.1.0" -source = "git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=44eca95823bb57e964cf7b6d9791ed2ccb4b2108#44eca95823bb57e964cf7b6d9791ed2ccb4b2108" +source = "git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=ab933e7cbd569f79b37b540412a7990a5352dd66#ab933e7cbd569f79b37b540412a7990a5352dd66" dependencies = [ "core-foundation-sys", "coreaudio-sys", @@ -1146,7 +1146,7 @@ dependencies = [ [[package]] name = "cubeb-coreaudio" version = "0.1.0" -source = "git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=44eca95823bb57e964cf7b6d9791ed2ccb4b2108#44eca95823bb57e964cf7b6d9791ed2ccb4b2108" +source = "git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=ab933e7cbd569f79b37b540412a7990a5352dd66#ab933e7cbd569f79b37b540412a7990a5352dd66" dependencies = [ "atomic", "audio-mixer", diff --git a/third_party/rust/cubeb-coreaudio/.cargo-checksum.json b/third_party/rust/cubeb-coreaudio/.cargo-checksum.json index ad1f9d96a05d..ccffaff46da8 100644 --- a/third_party/rust/cubeb-coreaudio/.cargo-checksum.json +++ b/third_party/rust/cubeb-coreaudio/.cargo-checksum.json @@ -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":"e822b4496e2ea5c6e1a288c6e92f57e598abf67cb0bdff813f859d57c63be5f9","src/backend/auto_release.rs":"050fdcee74cf46b9a8a85a877e166d72a853d33220f59cf734cbb6ea09daa441","src/backend/buffer_manager.rs":"7aa294ef26ee68ff6a131b892a97ea65571f1fe0dedaef2cc6c966d1e135d89d","src/backend/device_property.rs":"2a63837b98b9b6bfb314b4aa6dce919412b71e13e18c7b8f3477aa1482f70b29","src/backend/mixer.rs":"949c34927ba72b3365bc733a63b2f7950aef707ee08363f97242a4de6b7d4818","src/backend/mod.rs":"41d103a20b72ddf1b45315dc5230722762b16b192dfafe146279447230a21272","src/backend/resampler.rs":"8641c672d00f77be287d64f6cd4a2b2cd36f8630e2ded1eff6b39834b1b7ddc3","src/backend/tests/aggregate_device.rs":"7542cbb1c82398d00a5cba5b335842c517af2cda887946ebb5aaf512fd06b527","src/backend/tests/api.rs":"6eafca24d61729cad108b34c01e339130f9c479ebbe1026dc9c65778c1d9cfe0","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":"3c430e519c0e7a17dda6b57c110fab725a846da39606fd99274bad20a637cf35","src/backend/utils.rs":"6c3ffbcd602e6cc9f56deb9ecb07b2eef2e6f074ef924178e466f380aae5c595","src/capi.rs":"21b66b70545bf04ec719928004d1d9adb45b24ced51288f5b2993d79aaf78f5f","src/lib.rs":"5e586d45cd6b3722f0a6736d9252593299269817a153eef1930a5fb9bfbb56f5","todo.md":"efc1f012eb9a331a040cad4ac03aa79307f25885f71b6fb38f3ad7af8d7d515c"},"package":null} \ No newline at end of file +{"files":{".circleci/config.yml":"7f3dc865105ca8f33965a7958b1fe2e627ae2d5a703f3b2a4ab6e2e796018597",".editorconfig":"4e53b182bcc78b83d7e1b5c03efa14d22d4955c4ed2514d1ba4e99c1eb1a50ba",".githooks/pre-push":"8b8b26544cd56f54c0c33812551f786bb25cb08c86dbfeb6bf3daad881c826a1",".github/workflows/test.yml":"aa1998a3b104ad131805ca3513832cef3f65300192824f8b1efc9a5a0cc108f6",".travis.yml":"dc07bac53f70f16c9bdf52264bdc58500ae6018c1b4c567bc7642f6b4ca3cc35","Cargo.toml":"24d952cc7a852ea8675683d6b4332254eac0d64ba60749d3797381bbf4d32ad9","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":"e822b4496e2ea5c6e1a288c6e92f57e598abf67cb0bdff813f859d57c63be5f9","src/backend/auto_release.rs":"050fdcee74cf46b9a8a85a877e166d72a853d33220f59cf734cbb6ea09daa441","src/backend/buffer_manager.rs":"c32bff1f05c47afc5472d2ebdd321c1186bffcf676ba03751c0962277963ffcc","src/backend/device_property.rs":"2a63837b98b9b6bfb314b4aa6dce919412b71e13e18c7b8f3477aa1482f70b29","src/backend/mixer.rs":"ed299d3954e2a823060c870a8244673a7d4bca530830cb66b964d047a80ee3af","src/backend/mod.rs":"280da1670b87c776ee1f63aa89ba55277ef0839fa6ef4bd21672826c4c87872b","src/backend/resampler.rs":"8641c672d00f77be287d64f6cd4a2b2cd36f8630e2ded1eff6b39834b1b7ddc3","src/backend/tests/aggregate_device.rs":"7542cbb1c82398d00a5cba5b335842c517af2cda887946ebb5aaf512fd06b527","src/backend/tests/api.rs":"6eafca24d61729cad108b34c01e339130f9c479ebbe1026dc9c65778c1d9cfe0","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":"9ed857625147c3d13c1458e630db8a78362612e6ef679d918bfdafa6e927fe75","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":"3c430e519c0e7a17dda6b57c110fab725a846da39606fd99274bad20a637cf35","src/backend/utils.rs":"6c3ffbcd602e6cc9f56deb9ecb07b2eef2e6f074ef924178e466f380aae5c595","src/capi.rs":"21b66b70545bf04ec719928004d1d9adb45b24ced51288f5b2993d79aaf78f5f","src/lib.rs":"5e586d45cd6b3722f0a6736d9252593299269817a153eef1930a5fb9bfbb56f5","todo.md":"efc1f012eb9a331a040cad4ac03aa79307f25885f71b6fb38f3ad7af8d7d515c"},"package":null} \ No newline at end of file diff --git a/third_party/rust/cubeb-coreaudio/Cargo.toml b/third_party/rust/cubeb-coreaudio/Cargo.toml index e74925a58b44..81c4c5adbbca 100644 --- a/third_party/rust/cubeb-coreaudio/Cargo.toml +++ b/third_party/rust/cubeb-coreaudio/Cargo.toml @@ -11,7 +11,7 @@ crate-type = ["staticlib", "rlib"] atomic = "0.4" bitflags = "1.0" coreaudio-sys-utils = { path = "coreaudio-sys-utils" } -cubeb-backend = "0.10" +cubeb-backend = "0.10.1" float-cmp = "0.6" libc = "0.2" lazy_static = "1.2" diff --git a/third_party/rust/cubeb-coreaudio/src/backend/buffer_manager.rs b/third_party/rust/cubeb-coreaudio/src/backend/buffer_manager.rs index 723f3c051344..b0fdaef163b5 100644 --- a/third_party/rust/cubeb-coreaudio/src/backend/buffer_manager.rs +++ b/third_party/rust/cubeb-coreaudio/src/backend/buffer_manager.rs @@ -208,7 +208,7 @@ impl BufferManager { }; assert!(pushed <= to_push, "We don't support upmix"); if pushed != to_push { - cubeb_log!( + cubeb_alog!( "Input ringbuffer full, could only push {} instead of {}", pushed, to_push @@ -222,6 +222,11 @@ impl BufferManager { unsafe { slice::from_raw_parts_mut::(data as *mut i16, needed_samples) }; let read = p.pop_slice(input); if read < needed_samples { + cubeb_alog!( + "Underrun during input data pull: (needed: {}, available: {})", + needed_samples, + read + ); for i in 0..(needed_samples - read) { input[read + i] = 0; } @@ -232,6 +237,11 @@ impl BufferManager { unsafe { slice::from_raw_parts_mut::(data as *mut f32, needed_samples) }; let read = p.pop_slice(input); if read < needed_samples { + cubeb_alog!( + "Underrun during input data pull: (needed: {}, available: {})", + needed_samples, + read + ); for i in 0..(needed_samples - read) { input[read + i] = 0.0; } diff --git a/third_party/rust/cubeb-coreaudio/src/backend/mixer.rs b/third_party/rust/cubeb-coreaudio/src/backend/mixer.rs index 6f6817df1eca..a4f63926b16c 100644 --- a/third_party/rust/cubeb-coreaudio/src/backend/mixer.rs +++ b/third_party/rust/cubeb-coreaudio/src/backend/mixer.rs @@ -180,7 +180,7 @@ impl Mixer { assert!(out_channel_count > 0); cubeb_log!( - "Create a mixer with input channel count: {}, input layout: {:?}, \ + "Creating a mixer with input channel count: {}, input layout: {:?},\ out channel count: {}, output channels: {:?}", in_channel_count, input_layout, @@ -189,7 +189,9 @@ impl Mixer { ); let input_channels = if in_channel_count as u32 != input_layout.bits().count_ones() { - cubeb_log!("Mismatch between input channels and layout. Apply default layout instead"); + cubeb_log!( + "Mismatch between input channels and layout. Applying default layout instead" + ); get_default_channel_order(in_channel_count) } else { get_channel_order(input_layout) diff --git a/third_party/rust/cubeb-coreaudio/src/backend/mod.rs b/third_party/rust/cubeb-coreaudio/src/backend/mod.rs index d57b77098fed..bc52482eede6 100644 --- a/third_party/rust/cubeb-coreaudio/src/backend/mod.rs +++ b/third_party/rust/cubeb-coreaudio/src/backend/mod.rs @@ -199,7 +199,7 @@ fn create_device_info(devid: AudioDeviceID, devtype: DeviceType) -> Option input_frames_needed as usize { input_buffer_manager.trim(input_frames_needed); let popped_frames = buffered_input_frames - input_frames_needed as usize; - cubeb_log!("Dropping {} frames in input buffer.", popped_frames); + cubeb_alog!("Dropping {} frames in input buffer.", popped_frames); } let input_frames = if input_frames_needed > buffered_input_frames @@ -609,7 +609,7 @@ extern "C" fn audiounit_output_callback( { // The silent frames will be inserted in `get_linear_data` below. let silent_frames_to_push = input_frames_needed - buffered_input_frames; - cubeb_log!( + cubeb_alog!( "({:p}) Missing Frames: {} will append {} frames of input silence.", stm.core_stream_data.stm_ptr, if stm.frames_read.load(Ordering::SeqCst) == 0 { @@ -716,7 +716,7 @@ extern "C" fn audiounit_property_listener_callback( let addrs = unsafe { slice::from_raw_parts(addresses, address_count as usize) }; if stm.switching_device.load(Ordering::SeqCst) { cubeb_log!( - "Switching is already taking place. Skip Events for device {}", + "Switching is already taking place. Skipping event for device {}", id ); return NO_ERR; @@ -725,9 +725,8 @@ extern "C" fn audiounit_property_listener_callback( let mut input_device_dead = false; - // Log the events cubeb_log!( - "({:p}) Handle {} device changed events for device {}", + "({:p}) Handling {} device changed events for device {}", stm as *const AudioUnitStream, address_count, id @@ -743,7 +742,7 @@ extern "C" fn audiounit_property_listener_callback( // Handle the events if input_device_dead { - cubeb_log!("The user-selected input device is dead, enter error state"); + cubeb_log!("The user-selected input device is dead, entering error state"); stm.stopped.store(true, Ordering::SeqCst); stm.core_stream_data.stop_audiounits(); stm.close_on_error(); @@ -803,7 +802,7 @@ fn audiounit_convert_channel_layout(layout: &AudioChannelLayout) -> Vec Result { set_device_to_audiounit(unit, device.id).map_err(|e| { cubeb_log!( - "Fail to set device {} to the created audiounit. Error: {}", + "Failed to set device {} to the created audiounit. Error: {}", device.id, e ); @@ -1158,7 +1157,7 @@ fn set_buffer_size_sync(unit: AudioUnit, devtype: DeviceType, frames: u32) -> Re set_buffer_size(unit, devtype, frames).map_err(|e| { cubeb_log!( - "Fail to set buffer size for AudioUnit {:?} for {:?}. Error: {}", + "Failed to set buffer size for AudioUnit {:?} for {:?}. Error: {}", unit, devtype, e @@ -1172,7 +1171,7 @@ fn set_buffer_size_sync(unit: AudioUnit, devtype: DeviceType, frames: u32) -> Re let (chg, timeout_res) = cvar.wait_timeout(changed, waiting_time).unwrap(); if timeout_res.timed_out() { cubeb_log!( - "Time out for waiting the buffer frame size setting of AudioUnit {:?} for {:?}", + "Timed out for waiting the buffer frame size setting of AudioUnit {:?} for {:?}", unit, devtype ); @@ -1303,7 +1302,7 @@ fn get_fixed_latency(devid: AudioObjectID, devtype: DeviceType) -> u32 { let stream_latency = get_device_streams(devid, devtype).and_then(|streams| { if streams.is_empty() { cubeb_log!( - "No any stream on device {} in {:?} scope!", + "No stream on device {} in {:?} scope!", devid, devtype ); @@ -1338,13 +1337,13 @@ fn get_device_group_id( match get_custom_group_id(id, devtype) { Some(id) => return Ok(id), None => { - cubeb_log!("Get model uid instead."); + cubeb_log!("Getting model UID instead."); } }; } Ok(trans_type) => { cubeb_log!( - "The transport type is {:?}. Get model uid instead.", + "The transport type is {:?}. Getting model UID instead.", convert_uint32_into_string(trans_type) ); } @@ -1373,7 +1372,7 @@ fn get_custom_group_id(id: AudioDeviceID, devtype: DeviceType) -> Option { const GROUP_ID: &str = "builtin-internal-mic|spk"; cubeb_log!( - "Use hardcode group id: {} when source is: {:?}.", + "Using hardcode group id: {} when source is: {:?}.", GROUP_ID, convert_uint32_into_string(s.unwrap()) ); @@ -1382,7 +1381,7 @@ fn get_custom_group_id(id: AudioDeviceID, devtype: DeviceType) -> Option { const GROUP_ID: &str = "builtin-external-mic|hdpn"; cubeb_log!( - "Use hardcode group id: {} when source is: {:?}.", + "Using hardcode group id: {} when source is: {:?}.", GROUP_ID, convert_uint32_into_string(s.unwrap()) ); @@ -1444,7 +1443,7 @@ fn create_cubeb_device_info( } Err(e) => { cubeb_log!( - "Cannot get the uid for device {} in {:?} scope. Error: {}", + "Cannot get the UID for device {} in {:?} scope. Error: {}", devid, devtype, e @@ -1458,7 +1457,7 @@ fn create_cubeb_device_info( } Err(e) => { cubeb_log!( - "Cannot get the model uid for device {} in {:?} scope. Error: {}", + "Cannot get the model UID for device {} in {:?} scope. Error: {}", devid, devtype, e @@ -1547,7 +1546,7 @@ fn create_cubeb_device_info( latency + range.mMaximum as u32, ), Err(e) => { - cubeb_log!("Cannot get the buffer frame size for device {} in {:?} scope. Use default value instead. Error: {}", devid, devtype, e); + cubeb_log!("Cannot get the buffer frame size for device {} in {:?} scope. Using default value instead. Error: {}", devid, devtype, e); ( 10 * dev_info.default_rate / 1000, 100 * dev_info.default_rate / 1000, @@ -1659,7 +1658,7 @@ fn audiounit_get_devices_of_type(devtype: DeviceType) -> Vec { let info = format!("{} ({})", device, label); if let Ok(channels) = get_channel_count(device, devtype) { - cubeb_log!("device {} has {} {:?}-channels", info, channels, devtype); + cubeb_log!("Device {} has {} {:?}-channels", info, channels, devtype); if channels > 0 { devices_in_scope.push(device); } @@ -1755,7 +1754,9 @@ impl DevicesData { } fn is_empty(&self) -> bool { - self.changed_callback == None && self.callback_user_ptr.is_null() && self.devices.is_empty() + self.changed_callback.is_none() + && self.callback_user_ptr.is_null() + && self.devices.is_empty() } } @@ -2350,17 +2351,32 @@ impl<'ctx> CoreStreamData<'ctx> { // It's impossible to create an aggregate device from an aggregate device, and it's // unnecessary to create an aggregate device when opening the same device input/output. In // all other cases, use an aggregate device. - let mut either_already_aggregate = false; if self.has_input() { - either_already_aggregate |= + let input_is_aggregate = get_device_transport_type(self.input_device.id, DeviceType::INPUT).unwrap_or(0) == kAudioDeviceTransportTypeAggregate; + if input_is_aggregate { + either_already_aggregate = true; + } + cubeb_log!( + "Input device ID: {} (aggregate: {:?})", + self.input_device.id, + input_is_aggregate + ); } if self.has_output() { - either_already_aggregate |= + let output_is_aggregate = get_device_transport_type(self.output_device.id, DeviceType::OUTPUT).unwrap_or(0) == kAudioDeviceTransportTypeAggregate; + if output_is_aggregate { + either_already_aggregate = true; + } + cubeb_log!( + "Output device ID: {} (aggregate: {:?})", + self.input_device.id, + output_is_aggregate + ); } // Only use an aggregate device when the device are different. self.has_input() @@ -2437,15 +2453,15 @@ impl<'ctx> CoreStreamData<'ctx> { out_dev_info.flags = device_flags::DEV_OUTPUT; self.aggregate_device = Some(device); cubeb_log!( - "({:p}) Use aggregate device {} for input and output.", + "({:p}) Using an aggregate device {} for input and output.", self.stm_ptr, self.aggregate_device.as_ref().unwrap().get_device_id() ); } Err(e) => { cubeb_log!( - "({:p}) Create aggregate devices failed. Error: {}.\ - Use assigned devices directly instead.", + "({:p}) Creation of aggregate devices failed. Error: {}.\ + Using assigned devices directly instead.", self.stm_ptr, e ); @@ -2461,7 +2477,7 @@ impl<'ctx> CoreStreamData<'ctx> { // Configure I/O stream if self.has_input() { cubeb_log!( - "({:p}) Initialize input by device info: {:?}", + "({:p}) Initializing input by device info: {:?}", self.stm_ptr, in_dev_info ); diff --git a/third_party/rust/cubeb-coreaudio/src/backend/tests/interfaces.rs b/third_party/rust/cubeb-coreaudio/src/backend/tests/interfaces.rs index da3e990fbda2..1b7c2cf3854e 100644 --- a/third_party/rust/cubeb-coreaudio/src/backend/tests/interfaces.rs +++ b/third_party/rust/cubeb-coreaudio/src/backend/tests/interfaces.rs @@ -574,11 +574,14 @@ fn test_ops_stream_current_device() { println!("stream_get_current_device only works when the machine has both input and output devices"); return; } + let mut device: *mut ffi::cubeb_device = ptr::null_mut(); - assert_eq!( - unsafe { OPS.stream_get_current_device.unwrap()(stream, &mut device) }, - ffi::CUBEB_OK - ); + if unsafe { OPS.stream_get_current_device.unwrap()(stream, &mut device) } != ffi::CUBEB_OK { + // It can happen when we fail to get the device source. + println!("stream_get_current_device fails. Skip this test."); + return; + } + assert!(!device.is_null()); // Uncomment the below to print out the results. // let deviceref = unsafe { DeviceRef::from_ptr(device) }; diff --git a/toolkit/library/rust/shared/Cargo.toml b/toolkit/library/rust/shared/Cargo.toml index d6d4b2e8edfd..0d621f92425b 100644 --- a/toolkit/library/rust/shared/Cargo.toml +++ b/toolkit/library/rust/shared/Cargo.toml @@ -22,7 +22,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" } -cubeb-coreaudio = { git = "https://github.com/mozilla/cubeb-coreaudio-rs", rev = "44eca95823bb57e964cf7b6d9791ed2ccb4b2108", optional = true } +cubeb-coreaudio = { git = "https://github.com/mozilla/cubeb-coreaudio-rs", rev = "ab933e7cbd569f79b37b540412a7990a5352dd66", optional = true } cubeb-pulse = { git = "https://github.com/mozilla/cubeb-pulse-rs", rev="1f1fe1e08e01a9a534ec7f079702a583a0899ce7", optional = true, features=["pulse-dlopen"] } cubeb-sys = { version = "0.10.1", optional = true, features=["gecko-in-tree"] } audioipc2-client = { git = "https://github.com/kinetiknz/audioipc-2", rev = "ea7cabf8c9dc051a52ffb6cd7d2564b29b7428eb", optional = true } # macos (v2) branch