Bug 259193 - 1-channel hardware devices from getUserMedia() appears to have silence in a second track
Summary: 1-channel hardware devices from getUserMedia() appears to have silence in a s...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Safari 16
Hardware: All Unspecified
: P2 Major
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-07-13 09:34 PDT by Marc Bakos
Modified: 2023-07-20 09:35 PDT (History)
5 users (show)

See Also:


Attachments
Safari microphone test (see comments for more information) (2.78 KB, text/html)
2023-07-13 09:34 PDT, Marc Bakos
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Bakos 2023-07-13 09:34:25 PDT
Created attachment 467034 [details]
Safari microphone test (see comments for more information)

When a mono device is opened our experiements suggest this results (incorrectly) in a 2 channel stream with silence in the second channel.

In this case the mono device is Macbook internal microphone with echoCancellation = false, on Safari 15.4 and 16.0.

Simplest test case is connecting the microphone directly to <audio> node (see attached test case -- beware as it loops back audio). Observe different behaviour in Chromium and Safari.

Also various experiments in WebAudio suggest the stream is actually stereo (see test case which attempts to up-mix to stereo)

Because Webkit does not implement "channelCount" on the MediaTrack we have to infer the actual number of channels from experimenting in WebAudio, WebRTC.

In practice this breaks the users expectations if they use a regular microphone. And with ambiguitity between a 1 channel + silence stream and an actual stereo one, we can't sensibly 
workaround in WebAudio either.

The behaviour on Chromium seems correct -- it states the MediaTrack as 1 channel and up-mixes as appropriate.

The behaviour on older Safari/macOS/MacBook seemed to be correct, making this a regression. A change in hardware or OS leaves Safari seeing mono audio devices where previously it did not? It's not clear at the moment.
Comment 1 Radar WebKit Bug Importer 2023-07-20 09:35:17 PDT
<rdar://problem/112602770>