Bug 247119 - "A MediaStreamTrack ended due to a capture failure" when selecting bluetooth headphones as audio input device
Summary: "A MediaStreamTrack ended due to a capture failure" when selecting bluetooth ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 16
Hardware: Mac (Intel) macOS 12
: P2 Major
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-10-27 04:09 PDT by Tal Bar
Modified: 2022-10-28 02:49 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tal Bar 2022-10-27 04:09:42 PDT
In continuation to the discussion in https://bugs.webkit.org/show_bug.cgi?id=233473, as requested by @youenn fablet I'm opening this new issue. 
However, I do see a few other "NEW" issues that could be related:
https://bugs.webkit.org/show_bug.cgi?id=232835
https://bugs.webkit.org/show_bug.cgi?id=221192


I'm encountering this bug on Safari Version 16.0 (17614.1.25.9.10, 17614).

When selecting bluetooth headphones (WH-1000XM2) as audio input device, I'm getting "A MediaStreamTrack ended due to a capture failure".
I was able to reproduce it in Google Meet. 



I did have some luck playing around with the OS default input device. 
When I set it as the bluetooth headphones, it worked for several attempts. but now, it doesn't seem to make any difference anymore.. 

This bug makes using Safari + bluetooth headphones for video calls impossible!
This issue doesn't occur using Chrome or Firefox.
Comment 1 Radar WebKit Bug Importer 2022-10-27 04:19:55 PDT
<rdar://problem/101628857>
Comment 2 youenn fablet 2022-10-27 04:40:36 PDT
Looking at the sysdiagnose provided by Mal Bar, it seems we compute a buffer size that is too small for what is expected by the BT headphones.
We detect that it is too small but next recompilation will use the AudioSession buffer size, which remains the same. Hence a loop and a timer based failure.

It might be the AudioSession is computing according the default device, while we are using a non default device.
We should probably make this code more robust to this error.
Comment 3 youenn fablet 2022-10-27 05:18:00 PDT
I am not able to reproduce with AirPods, so it might some BT headsets that have the issue.
Comment 4 youenn fablet 2022-10-27 06:32:25 PDT
Pull request: https://github.com/WebKit/WebKit/pull/5855
Comment 5 EWS 2022-10-28 02:49:37 PDT
Committed 256091@main (b818b253da1d): <https://commits.webkit.org/256091@main>

Reviewed commits have been landed. Closing PR #5855 and removing active labels.