Apple Studio Display microphone extremely distorted
Categories
(Core :: Audio/Video: cubeb, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr115 | --- | unaffected |
firefox122 | --- | wontfix |
firefox123 | --- | wontfix |
firefox124 | --- | fixed |
firefox125 | --- | fixed |
People
(Reporter: ben, Assigned: pehrsons)
References
(Regression)
Details
(Keywords: regression)
Attachments
(13 files, 1 obsolete file)
135.30 KB,
audio/mpeg
|
Details | |
149.25 KB,
audio/mpeg
|
Details | |
121.63 KB,
audio/mpeg
|
Details | |
137.25 KB,
audio/mpeg
|
Details | |
3.27 KB,
text/plain
|
Details | |
3.04 KB,
application/json
|
Details | |
6.99 MB,
application/x-gzip
|
Details | |
33.11 KB,
text/plain
|
Details | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
48 bytes,
text/x-phabricator-request
|
diannaS
:
approval-mozilla-beta+
|
Details | Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:122.0) Gecko/20100101 Firefox/122.0
Steps to reproduce:
I noticed this on Google Meet, but the issue is reproducible for me on any site that records audio.
Steps to reproduce:
- Use Firefox beta (122.0b9 in my case)
- Visit https://online-voice-recorder.com . The issue isn't specific to this site, but it's easy to show the problem.
- Click record and use the Apple Studio Display microphone.
- Record some audio.
- Play back the audio in the browser, or download the file.
This issue happens consistently in Firefox Beta, even in "safe mode" and a clean profile. I've also reinstalled the app (overwrite /Applications/Firefox.app
) and the issue persists.
This issue does not happen:
- In the release version of Firefox (121.0.1)
- When using other input devices (Macbook Pro microphone or Bose QC 45 headphones)
- In Google Chrome (120.0.6099.216)
- In other applications (e.g., Zoom, Loom, etc)
Actual results:
Upon playback, the audio is extremely distorted.
Expected results:
The audio should be clear, as with other apps.
Reporter | ||
Comment 1•10 months ago
|
||
Reporter | ||
Comment 2•10 months ago
|
||
Reporter | ||
Comment 3•10 months ago
|
||
Reporter | ||
Comment 4•10 months ago
|
||
Reporter | ||
Comment 5•10 months ago
|
||
Attaching media section of about:support
Comment 6•10 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video: Playback' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Reporter | ||
Comment 7•10 months ago
|
||
Now that 122.0 hit stable, I re-tested this and still have the same issue. So this does appear to be a regression between 121.0 and 122.0.
Updated•9 months ago
|
Assignee | ||
Comment 8•9 months ago
|
||
Thanks for the report! Could you help me by gathering some logs, please?
- Go to about:logging, select the WebRTC preset, click Start Logging
- In another tab reproduce the issue
- Back on about:logging, click Stop Logging
- A new tab will open with the Firefox Profiler. On the top right, find the button to upload the profile, and include hidden threads. Then share the link here.
I'm marking this as a regression from bug 1670633 because it seems most likely, but we'll update as needed later.
Comment 10•9 months ago
|
||
I have the same issue, here is the output of my Firefox Profiler
https://bugzilla.mozilla.org/attachment.cgi?id=9377447
(In reply to Andreas Pehrson [:pehrsons] from comment #8)
Thanks for the report! Could you help me by gathering some logs, please?
- Go to about:logging, select the WebRTC preset, click Start Logging
- In another tab reproduce the issue
- Back on about:logging, click Stop Logging
- A new tab will open with the Firefox Profiler. On the top right, find the button to upload the profile, and include hidden threads. Then share the link here.
I'm marking this as a regression from bug 1670633 because it seems most likely, but we'll update as needed later.
Reporter | ||
Comment 11•9 months ago
|
||
Here's the requested profiler info: https://share.firefox.dev/3vY7so6 . Thanks!
Assignee | ||
Comment 12•9 months ago
|
||
I could not reproduce this with the virtual blackhole-16ch device, but my hunch is that this is related to us configuring the output device for 8ch, and that it's the same as the input device.
I have a speculative fix on try https://treeherder.mozilla.org/jobs?repo=try&revision=9ca9c9ca4c1290da62fbc31eec122fcc2a5958f7. I'll post a link to the build when it's ready or you could go there and dig it out (click the B for a build config when it's green, and dig it out among the artifacts. You're looking for target.dmg)
Assignee | ||
Updated•9 months ago
|
Comment 13•9 months ago
|
||
I did find there is no issue when using a Logitec USB webcam mic. it seems specific to the Apple Studio Display built in mic.
Reporter | ||
Comment 14•9 months ago
|
||
I just tested the build from your link and the issue persists. Here are profiler logs from that build: https://share.firefox.dev/48Up1Ut
Assignee | ||
Comment 15•9 months ago
|
||
Thanks for the feedback. I'll have to attribute it to this specific microphone then, and not how voice processing interacts with the output. I'll try to get my hands on one of these but it could take a little while. If anyone is interested in looking into the code that sets this up themselves, I can give some pointers on where to start.
Reporter | ||
Comment 16•9 months ago
|
||
Although I'd be starting from "zero" with this codebase, I am a developer, so I might be able to help. Is there any additional debugging data I could provide to help narrow down the issue?
Assignee | ||
Comment 17•9 months ago
|
||
(In reply to Ben Limmer from comment #16)
Although I'd be starting from "zero" with this codebase, I am a developer, so I might be able to help. Is there any additional debugging data I could provide to help narrow down the issue?
Thanks, I'll give you some pointers.
We use libcubeb for audio, the macOS backend is cubeb-coreaudio-rs. You'll need rust to build it with cargo build
. When running tests on macOS 14 there are some platform issues that may cause hangs so easiest to linearize them with RUST_TEST_THREADS=1 ./run_tests.sh
.
As a starting point you can use the vpio-mono-output-logging branch. It's the basis for the build in comment 12, plus verbose logging enabled in the manual test_streams_tester
test case. For playing around a bit, it's the easiest to use: cargo test test_stream_tester -- --ignored --nocapture
.
I'd be most suspicious of where we request mono from the input or where we interpret input data.
Reporter | ||
Comment 18•9 months ago
|
||
I didn't go so far as putting breakpoints or stepping through the code, but I did run the test suite from your branch (see attached test output).
I also played ran the stream tester, but I'd need to dedicate some more time to figuring out how it works and reviewing the codebase. I'm not sure if any of this information here is helpful or not.
cargo test test_stream_tester -- --ignored --nocapture
warning: lint `private_in_public` has been removed: replaced with another group of lints, see RFC <https://rust-lang.github.io/rfcs/2145-type-privacy.html> for more information
--> src/backend/mod.rs:3752:24
|
3752 | #[cfg_attr(test, allow(private_in_public))]
| ^^^^^^^^^^^^^^^^^
|
= note: `#[warn(renamed_and_removed_lints)]` on by default
warning: function `test_disable_log` is never used
--> src/backend/tests/utils.rs:17:8
|
17 | pub fn test_disable_log() {
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: `cubeb-coreaudio` (lib test) generated 2 warnings
Finished test [unoptimized + debuginfo] target(s) in 0.02s
Running unittests src/lib.rs (target/debug/deps/cubeb_coreaudio-a185629f92f4df5c)
running 1 test
commands:
'q': quit
'c': create a stream
'd': destroy a stream
's': start the created stream
't': stop the created stream
'r': register a device changed callback
'l': set loopback (DUPLEX-only)
'v': set volume
'm': set input mute
'p': set input processing
c
Select stream type:
1) Input 2) Output 3) In-Out Duplex 4) Back
1
Select input device:
0: System default
1: 00AF2102-97A5-4995-A66D-BB1500000003
AudioObjectID: 111
uid: iPhone Microphone
2: AppleUSBAudioEngine:Apple Inc.:Studio Display:00008030-001019A21EB9802E:6,7
AudioObjectID: 57
uid: Studio Display Microphone
3: BuiltInMicrophoneDevice
AudioObjectID: 106
uid: MacBook Pro Microphone
4: com.loom.desktop.audio-device.device
AudioObjectID: 85
uid: LoomAudioDevice
2
mod.rs:2328: Use global latency 512 instead of the requested latency 4096.
mod.rs:2702: Input device ID: 57 (aggregate: false)
mod.rs:2872: (0x124b04380) Initializing input by device info: device_info { id: 57, flags: device_flags(DEV_INPUT) }
mod.rs:2890: (0x124b04380) Opening input side: rate 48000, channels 1, format Float32LE, layout FRONT_CENTER, prefs VOICE, latency in frames 512, voice processing false.
mod.rs:2920: (0x124b04380) Input hardware description: AudioStreamBasicDescription { mSampleRate: 48000.0, mFormatID: 1819304813, mFormatFlags: 9, mBytesPerPacket: 4, mFramesPerPacket: 1, mBytesPerFrame: 4, mChannelsPerFrame: 1, mBitsPerChannel: 32, mReserved: 0 }
mod.rs:1294: The buffer frame size of AudioUnit 0x92bc00ae for INPUT is already 512
mod.rs:3040: (0x124b04380) Input audiounit init with device 57 successfully.
cubeb_resampler_internal.h:521:Input and output sample-rate match, target rate of 48000Hzmod.rs:2393: (0x124b04380) Cubeb stream init successful.
Stream 0x124b04380 created.
commands:
'q': quit
'c': create a stream
'd': destroy a stream
's': start the created stream
't': stop the created stream
'r': register a device changed callback
'l': set loopback (DUPLEX-only)
'v': set volume
'm': set input mute
'p': set input processing
t
state: Stopped
mod.rs:4090: Cubeb stream (0x124b04380) stopped successfully.
Stream 0x124b04380 stopped.
commands:
'q': quit
'c': create a stream
'd': destroy a stream
's': start the created stream
't': stop the created stream
'r': register a device changed callback
'l': set loopback (DUPLEX-only)
'v': set volume
'm': set input mute
'p': set input processing
test backend::tests::manual::test_stream_tester has been running for over 60 seconds
q
Quit.
mod.rs:4039: Cubeb stream (0x124b04380) destroyed successful.
Stream 0x124b04380 destroyed.
test backend::tests::manual::test_stream_tester ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 198 filtered out; finished in 77.19s
Assertion failed: (logging_thread.get_id() == std::thread::id() && (g_cubeb_log_callback == cubeb_noop_log_callback || !g_cubeb_log_callback)), function ~cubeb_async_logger, file cubeb_log.cpp, line 146.
Sorry I haven't been of more help on this, I haven't had much free hacking time lately.
Assignee | ||
Comment 19•9 months ago
|
||
No worries, thanks for the help so far.
I have access to one of these displays now so I'll take a look shortly.
Assignee | ||
Comment 20•9 months ago
|
||
It appears that without the platform AGC the signal goes completely out of bounds. I had done some simple testing of the AGC before and it appeared to not be able to amplify the signal if it is weak, therefore I turned it off. It appears we need it to avoid clipping. I'll put up a fix.
Assignee | ||
Comment 21•9 months ago
|
||
Here are some test builds if you want to give it a spin before hitting Nightly: https://treeherder.mozilla.org/jobs?repo=try&revision=8ef7d10e47886739aca7469ac00412501fc27b69
Assignee | ||
Comment 22•9 months ago
|
||
Comment 23•9 months ago
|
||
Comment 24•9 months ago
|
||
bugherder |
Assignee | ||
Updated•9 months ago
|
Assignee | ||
Comment 25•9 months ago
|
||
I hear reports of other input devices exaggeratingly amplifying low-volume background noises with this fix. So rather than impacting all devices with that we'd rather live with this clipping issue on the studio display only. I'll ask to have this backed out. I can instead land a pref to allow disabling the VoiceProcessingIO audio unit added in bug 1670633, which should revert behavior to what we had in 121.
Reporter | ||
Comment 26•9 months ago
|
||
Is there a way to flip the switch automatically based on the characteristics of the Studio Display? As a frequent user of Google Meet, this bug has been quite painful to work around. I can certainly flip the switch myself, but others might not discover this.
Comment 27•9 months ago
|
||
Backed out as requested, for causing audio issues.
Comment 28•9 months ago
|
||
Backout merged to central:
Assignee | ||
Comment 29•9 months ago
|
||
(In reply to Ben Limmer from comment #26)
Is there a way to flip the switch automatically based on the characteristics of the Studio Display? As a frequent user of Google Meet, this bug has been quite painful to work around. I can certainly flip the switch myself, but others might not discover this.
I have put a blocklist in the backend also.
Updated•9 months ago
|
Assignee | ||
Comment 30•9 months ago
|
||
This update introduces a blocklist function for using VPIO, and
makes the platform AGC settable by param.
Assignee | ||
Comment 31•9 months ago
|
||
Intended as an escape valve and diagnosis tool in case someone has a device
setup that is troublesome with VPIO on macOS.
Assignee | ||
Comment 32•9 months ago
|
||
This update introduces a blocklist function for using VPIO, and
makes the platform AGC settable by param.
Original Revision: https://phabricator.services.mozilla.com/D202404
Updated•9 months ago
|
Assignee | ||
Comment 33•9 months ago
|
||
Intended as an escape valve and diagnosis tool in case someone has a device
setup that is troublesome with VPIO on macOS.
Original Revision: https://phabricator.services.mozilla.com/D202405
Updated•9 months ago
|
Comment 34•9 months ago
|
||
Comment 35•9 months ago
|
||
Uplift Approval Request
- Is Android affected?: no
- Code covered by automated testing: no
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: n/a
- Fix verified in Nightly: no
- String changes made/needed: None
- User impact if declined: Users on macOS using Apple's Studio Display for both audio input and output will capture distorted audio input
- Risk associated with taking this patch: low
- Explanation of risk level: This blocks uses of Apple Studio Display as input and output from using the fix from bug 1670633, effectively using the behavior prior to that bug. Also adds a pref but without affecting default behavior.
Comment 36•9 months ago
|
||
Backed out for causing assertion failures at media.getusermedia.microphone.prefer_voice_stream_with_processing.enabled
Backout link: https://hg.mozilla.org/integration/autoland/rev/0f11d5aca9e02300b1aa70ff8c42fa6456d80ffb
Comment 37•9 months ago
|
||
Updated•9 months ago
|
Updated•9 months ago
|
Comment 38•9 months ago
|
||
Assignee | ||
Updated•9 months ago
|
Comment 39•9 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a30f7bce38fe
https://hg.mozilla.org/mozilla-central/rev/ab4d27a3e7d9
https://hg.mozilla.org/mozilla-central/rev/4c97b568c14a
Comment 40•9 months ago
|
||
Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.
Updated•9 months ago
|
Updated•9 months ago
|
Updated•9 months ago
|
Comment 41•9 months ago
|
||
uplift |
Comment 42•9 months ago
|
||
uplift |
Updated•9 months ago
|
Reporter | ||
Comment 44•8 months ago
|
||
Confirmed this is fixed on 124.0b8! Thank you
Description
•