Bug 213853 - Mic input is not returned to the mediaStream after a GSM call
Summary: Mic input is not returned to the mediaStream after a GSM call
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 13
Hardware: iPhone / iPad iOS 13
: P2 Blocker
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-07-01 10:16 PDT by Francesco Durighetto (kekkokk)
Modified: 2021-11-22 13:42 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francesco Durighetto (kekkokk) 2020-07-01 10:16:16 PDT
Test environment:
- Device A, iPhone Xr iOS: 13.6 beta 3, Safari mobile browser
- Device B, whatever desktop/mobile browser

Use case:
User A and B are in a webrtc audio/video call (the audio getusermedia is done with the constraint echoCancellation: true, bu I don't think it matters).
User A receive a GSM call, answer to it.

What do you expect?
When user A join the GSM call, the audio mediaStreamTrack emit a muted event since the GSM call "steal" the input of the mic and when the user A dial out the call and goes back to the webrtc call in safari the microphone input came back active (as works for the camera input, which is handled correctly).

What happens instead?
The user A receives a stream muted event and the microphone input "stops", but when he dial out the GSM call the ownership of the microphone never goes back to Safari. In this case I would at least expect an ended event from the audio mediaStreamTrack to be able to manually do a getusermedia again, but this does not happen.
So it's impossible to programmatically know when the user microphone "blacks out".


This caused lots of complaints about clients whose have encountered audio problems after receiving normal GSM calls.
Comment 1 Radar WebKit Bug Importer 2020-07-02 17:56:57 PDT
<rdar://problem/65058300>
Comment 2 daginge 2020-07-22 04:39:54 PDT
Can confirm this is a problem. The underlying issue is that the microphone track goes to "muted" (by the OS) when you receive an incoming call, but it never goes back to "unmuted". 

The only fix I have been able to find is to add a button the user can click that there is a problem with the microphone, which is automatically removed should the audio track go back to "unmuted". If it doesn't, the user will see it, click the button, and we can restart the track and apply the new track to all the active PCs.

Note: None of the "visibilitychange" or similar browser events are fired upon returning from a call if you simply dismissed it. So I have not found a way to automatically detect that the user is back to automatically fix this yet. A user interaction is therefore needed.