Bug 215965

Summary: getUserMedia causes stall in audio output / unexpected audio ducking
Product: WebKit Reporter: Boris Smus <smus>
Component: WebRTCAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Major CC: eric.carlson, jer.noble, tomac, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: Unspecified   

Description Boris Smus 2020-08-28 19:22:05 PDT
My application has a button that opens audio input and simultaneously plays a UI sound to indicate that the mic is hot.

Here's a really basic test page that lets you play audio and then open the audio input via `getUserMedia`: https://codepen.io/borismus/pen/PoNjbPa 

Try this and notice the pause in music.

- On Mac it seems to fade out as if its deliberately ducking Or maybe this is just what happens when the main thread playing audio stalls. 
- On iOS it seems to pause abruptly as if it's some kind of blockage. 

The expected behavior is found in Chrome, where no pausing or ducking happens, and audio can play.
Comment 1 Radar WebKit Bug Importer 2020-09-01 06:03:39 PDT
<rdar://problem/68138897>
Comment 2 youenn fablet 2020-09-01 06:10:56 PDT
(In reply to Boris Smus from comment #0)
> My application has a button that opens audio input and simultaneously plays
> a UI sound to indicate that the mic is hot.
> 
> Here's a really basic test page that lets you play audio and then open the
> audio input via `getUserMedia`: https://codepen.io/borismus/pen/PoNjbPa 
> 
> Try this and notice the pause in music.
> 
> - On Mac it seems to fade out as if its deliberately ducking Or maybe this
> is just what happens when the main thread playing audio stalls.

I do not hear that on my Mac.
I can hear a slight pause.

This seems to be a system wide pause: the same happens if I open https://codepen.io/borismus/pen/PoNjbPa on Chrome and asks Chrome to play Music and then asks Safari to open audio input using the same fiddle. 

If I close Safari, the same temporary pause happens.
It might be that this happens when starting and stopping our core audio shared unit.

> - On iOS it seems to pause abruptly as if it's some kind of blockage. 

When you say pause, it is a temporary pause right?
This might be the same issue as MacOS.
Comment 3 Boris Smus 2020-09-01 11:45:34 PDT
Let's focus on iOS as that's where the problems is substantially worse.

I do mean a temporary pause, thanks for clarifying. It resumes in about one second on my iPhone X.
Comment 4 youenn fablet 2020-09-01 11:49:58 PDT
(In reply to Boris Smus from comment #3)
> Let's focus on iOS as that's where the problems is substantially worse.
> 
> I do mean a temporary pause, thanks for clarifying. It resumes in about one
> second on my iPhone X.

One second seems longer than what I can repro.
Would you be able to send me a sysdiagnose (youenn@apple.com)?
Comment 5 Boris Smus 2020-09-21 09:34:36 PDT
Quick update to nudge this along: I sent you the log part of that bundle on 9/2.