Bug 215270 - Safari is not able to hear audio when using WebRTC in multiple tabs
Summary: Safari is not able to hear audio when using WebRTC in multiple tabs
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 13
Hardware: Mac All
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-08-07 08:04 PDT by mgasp
Modified: 2020-09-02 02:45 PDT (History)
12 users (show)

See Also:


Attachments
Patch (6.50 KB, patch)
2020-09-01 07:21 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mgasp 2020-08-07 08:04:45 PDT
Being a little more specific, when openning a tab using window.open() function, it seems
that stopping audio in the second tab also "stops" the audio-receiving in the first one.

Tested in Safari 13.1.2 macOS High Sierra.
We can also reproduce this in all iOS devices we have tested: iOS versions 12+, 13+


Steps to reproduce, using two browsers: Browser 1 (B1) and Safari Browser (SB)

1 ) B1 join appr.tc room with audio/video. Let's call this room B1's room.

2 ) SB join appr.tc room with audio/video (make sure SB can hear B1).

* before continuing, make sure SB is able to open pop-up windows from appr-tc (Safari > Preferences > pop-up)

3) In SB, open JS console and type:
    window.open('https://appr.tc/','_blank');

   this should open a new tab with appr.tc website (but don't click Join yet!). 
   Leave this new tab open while you come back to the first tab.
   
4) In SB's first tab, hangup the call (By clicking on the "phone" icon at the
left of the page)
   
5) Go to SB's new tab and join any other room with audio/video. 
   After that you can close this new tab (you don't need to click hangup on this new tab)
   
6) Back to SB's first tab, join B1's room with audio/video. 
   SB won't hear audio anymore (it can speaks though). Refreshing page won't work. 
   You will need to close/open a new tab to make audio hearing working again.


Thanks in advance.
Comment 1 Radar WebKit Bug Importer 2020-08-08 17:51:30 PDT
<rdar://problem/66736746>
Comment 2 JH 2020-08-31 16:34:01 PDT
Running into this issue as well; Audio in the parent window will stop working if the child window calls "RTCRtpReceiver.getCapabilities()".

I made a codepen that makes it easy to reproduce the bug and confirmed that it happens on all iOS devices (v13+), Safari v13.1.2, and Safari Technology Preview r112: https://codepen.io/tigerroll/full/50dfa165dda2d6ba684103e8af7bd1e4
Comment 3 youenn fablet 2020-09-01 06:57:34 PDT
Thanks for the report.
Issue is that our audio module is per process while our backend expects it to be per peer connection factory.
Comment 4 youenn fablet 2020-09-01 07:21:47 PDT
Created attachment 407677 [details]
Patch
Comment 5 Darin Adler 2020-09-01 12:38:01 PDT
Comment on attachment 407677 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=407677&action=review

> Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:43
> -class LibWebRTCAudioModule final : public webrtc::AudioDeviceModule {
> +class LibWebRTCAudioModule : public webrtc::AudioDeviceModule {

What is this change about? Is there some class now derived from LibWebRTCAudioModule?
Comment 6 youenn fablet 2020-09-01 14:17:45 PDT
(In reply to Darin Adler from comment #5)
> Comment on attachment 407677 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=407677&action=review
> 
> > Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:43
> > -class LibWebRTCAudioModule final : public webrtc::AudioDeviceModule {
> > +class LibWebRTCAudioModule : public webrtc::AudioDeviceModule {
> 
> What is this change about? Is there some class now derived from
> LibWebRTCAudioModule?

Yes, RefCountedObject<LibWebRTCAudioModule>.
Comment 7 EWS 2020-09-02 02:45:35 PDT
Committed r266454: <https://trac.webkit.org/changeset/266454>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 407677 [details].