Bug 237203 - Bluetooth headphone stream can't be recaptured after AudioContext
Summary: Bluetooth headphone stream can't be recaptured after AudioContext
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 15
Hardware: Mac (Intel) macOS 11
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-25 05:19 PST by Mike Thomas
Modified: 2022-03-07 11:36 PST (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 Mike Thomas 2022-02-25 05:19:23 PST
It appears that AudioContext is not releasing Bluetooth headphones when a stream is destroyed.
The console logs an error when trying to re-use the headphones to get an audio stream: A MediaStreamTrack ended due to a capture failure

I have detailed steps to reproduce in a modified webrtc sample here.
https://github.com/webrtc/samples/pull/1526
It basically creates an AudioContext for a stream from headphones, then changes the audio input device to internal mic and then back to headphones, at which point the capture fails.


This bug suggests it can be solved by closing the AudioContext: 
https://bugs.webkit.org/show_bug.cgi?id=23635
However, the AudioContext doc recommends using a single AudioContext instance for multiple nodes, and therefore closing a whole context to release the hardware from one node is not a viable solution: https://developer.mozilla.org/en-US/docs/Web/API/AudioContext

Note that this issue is not present in other browsers, nor in safari with non-bluetooth devices.

A colleague was unable to reproduce with AirPods but we were able to reproduce using Sony WH-1000XM3 and Bose NC700 headphones.
Comment 1 Radar WebKit Bug Importer 2022-02-25 09:57:23 PST
<rdar://problem/89479520>
Comment 2 youenn fablet 2022-03-02 06:05:56 PST
I wonder whether this is https://bugs.webkit.org/show_bug.cgi?id=231280.
I am not able to reproduce on a recent safari build.
On which version can you reproduce? Is it also reproducing in STP?
Comment 3 Mike Thomas 2022-03-03 08:33:58 PST
I was using 15.0.
You could be right, I am unable to repro in 15.4 beta release.
Comment 4 youenn fablet 2022-03-07 11:36:55 PST
Marking as configuration changed