Bug 207041

Summary: Audio is not played from an audio element when the srcObject object has unstarted video tracks
Product: WebKit Reporter: Philipp Hancke <fippo>
Component: WebRTCAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, eric.carlson, ews-watchlist, glenn, jer.noble, philipj, sergio, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=209163
Attachments:
Description Flags
Patch none

Description Philipp Hancke 2020-01-31 06:55:17 PST
Once upon a time Chrome didn’t play audio on an audio element when the element’s srcObject contained a video track that hadn’t sent any data:
  https://bugs.chromium.org/p/chromium/issues/detail?id=738379
The reason was/is that for *video* elements loadedmetadata/onresize need to be fired which are not known without a (key)frame. Since audio elements don't fire these events they can just play.

This is still an issue in Safari as demonstrated by this fiddle:
  https://jsfiddle.net/47uvs3gt/
This reproduces a situation where a MediaStream with audio and video tracks is created on the receiving end but the sender does not send rtp packets.
This can very easily happen from Firefox (see https://github.com/w3c/mediacapture-main/issues/642) and also when an implementation makes an effort to ensure the camera light is turned off in other browsers.

https://jsfiddle.net/kcutdvhe/ - the stream splitting approach which used to work in Chrome also seems to work but would be great to avoid.

Note that https://jsfiddle.net/23s0odra/ which attempts to reproduce this without a RTCPeerConnection in between still works. But maybe because the video track readyState is ended?
Comment 1 Radar WebKit Bug Importer 2020-01-31 21:54:26 PST
<rdar://problem/59084745>
Comment 2 youenn fablet 2020-03-16 06:33:14 PDT
Created attachment 393651 [details]
Patch
Comment 3 WebKit Commit Bot 2020-03-16 09:36:42 PDT
Comment on attachment 393651 [details]
Patch

Clearing flags on attachment: 393651

Committed r258503: <https://trac.webkit.org/changeset/258503>
Comment 4 WebKit Commit Bot 2020-03-16 09:36:44 PDT
All reviewed patches have been landed.  Closing bug.