Bug 232822 - Audio Rate Gets Messed up With Safari WebRTC and Bluetooth Switching
Summary: Audio Rate Gets Messed up With Safari WebRTC and Bluetooth Switching
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 15
Hardware: iPhone / iPad Unspecified
: P2 Normal
Assignee: youenn fablet
Keywords: InRadar
: 234595 (view as bug list)
Depends on:
Reported: 2021-11-08 10:31 PST by Homerlex
Modified: 2022-03-09 09:12 PST (History)
14 users (show)

See Also:

Testing with No Headset To Having Headset (8.88 MB, video/mp4)
2021-11-08 10:31 PST, Homerlex
no flags Details
Testing with Headset To No Headset (8.88 MB, video/mp4)
2021-11-08 10:33 PST, Homerlex
no flags Details
Patch (4.44 KB, patch)
2021-11-17 12:00 PST, 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 Homerlex 2021-11-08 10:31:11 PST
Created attachment 443567 [details]
Testing with No Headset To Having Headset

While developing a web application that used WebRTC we found that there are conditions that cause Audio to get either sped up or slowed down when switching between using and not using a bluetooth headset.

I was able to come up with a simple repro case that doesn't involve any our custom code.

I've duplicated using iPhone mini (MG8F3LL/A) on iOS 15.1.  I have also duplicated on iPad Pro (MLMP2LL/A) on iOS 15.2 Beta.

Here are the repro steps:

* Turn off Bluetooth Devices
* In iOS Safari hit the following URL: https://webrtc.github.io/samples/src/content/getusermedia/audio/
* Notice that when you speak your voice is echoed back at you properly
* Now connect Bluetooth headset (I duplicate with both Airpods and Beats Flex)
* When you speak now it probably still sounds normal
* Now toggle the pause button (hit pause and then the play button)
* Now when you speak you hear that your voice is altered.  Sometimes the voice is high pitched and sometimes it is low pitched.

At this point refreshing the browser might not fix the audio.  You might have to restart Safari.

NOTE: In our application there are other scenarios (not exactly like the code in https://webrtc.github.io/samples/src/content/getusermedia/audio/) that result in similar audio problems but its too difficult to provide a simple repro case for those scenarios.

I have attached a recording of me speaking without bluetooth at first.  At the end of the video you can hear the very deep voice in the recording when I have Airpods on.

You can also duplicate by similar steps as above but start with the headset on and then removing them.  In this case the pitch of the audio gets higher.
Comment 1 Homerlex 2021-11-08 10:33:20 PST
Created attachment 443568 [details]
Testing with Headset To No Headset

This attachment demonstrates the audio change when going from having a headset to not having a headset
Comment 2 Radar WebKit Bug Importer 2021-11-15 10:32:34 PST
Comment 3 youenn fablet 2021-11-16 09:37:15 PST
Thanks Homerlex, I was able to reproduce
Comment 4 youenn fablet 2021-11-17 12:00:31 PST
Created attachment 444546 [details]
Comment 5 EWS 2021-11-17 23:53:32 PST
Committed r285985 (244382@main): <https://commits.webkit.org/244382@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 444546 [details].
Comment 6 Homerlex 2021-12-07 04:31:42 PST
Does anyone know what version of iOS the fix will be applied to?  I just tested with 15.2 beta 4 (19C5050b) and can still duplicate the problem.
Comment 7 Eric Carlson 2022-01-05 10:30:36 PST
*** Bug 234595 has been marked as a duplicate of this bug. ***
Comment 8 ztb 2022-01-05 11:37:10 PST
What version of iOS will this patch be available in?
Comment 9 rychouwei 2022-01-11 03:21:57 PST
Can anyone tell which version of IOS will this patch be available in?
Comment 10 youenn fablet 2022-03-09 09:12:14 PST
This should be fixed in iOS 15.4 betas