Bug 187227

Summary: Cloned MediaStream audio attached to peer connection causes local echo
Product: WebKit Reporter: Chad Phillips <webkit>
Component: WebRTCAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: eric.carlson, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Safari 11   
Hardware: iPhone / iPad   
OS: iOS 11   

Description Chad Phillips 2018-06-30 17:43:00 PDT
1. Peer connection with inbound/outbound audio/video stream attached to a video element
2. Clone the stream to re-use on another peer connection, and attach to other audio/video elements
3. Hide the first video element

This results in a local echo coming from the user's own microphone, not from any inbound audio.

What's really weird is that if I display the first video element again, the echo goes away and doesn't return.
Comment 1 Radar WebKit Bug Importer 2018-07-01 17:14:39 PDT
<rdar://problem/41704722>
Comment 2 youenn fablet 2018-07-01 17:14:49 PDT
Thanks for the report, would you be able to provide a jsfiddle or something like that so that we can easily reproduce the issue?
Comment 3 Chad Phillips 2018-07-03 09:07:58 PDT
Still trying to find a simple way to reproduce this issue for testing.

In the process I believe I at least found why the echo stops if I display the first video stream again.

As a simple demonstration, I recorded the issue, viewable here: https://youtu.be/eVQVSy6Edt8

The first playing video is a peer connection that's also sending local audio/video to a conferencing application. When I start a second peer connection that also has local audio/video, you'll see that the first video stops (audio stops too).

This doesn't seem to accord with the rules listed at https://webkit.org/blog/7763/a-closer-look-into-webrtc/, which say "MediaStream-backed media will autoplay if the web page is already playing audio", so I'm wondering if another bug is in order here?
Comment 4 Chad Phillips 2018-10-05 06:39:03 PDT
This turned out to be audio playing from a video element with a local stream attached. Setting the mute property on the local video element solved the issue.