Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 913a59298c3e3ba7973214d77e8833f228eb1d8a
      
https://github.com/WebKit/WebKit/commit/913a59298c3e3ba7973214d77e8833f228eb1d8a
  Author: Youenn Fablet <you...@apple.com>
  Date:   2025-07-31 (Thu, 31 Jul 2025)

  Changed paths:
    M 
Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm

  Log Message:
  -----------
  (iOS) getUserMedia() incorrectly emit 'devicechange' listener
rdar://156311847
https://bugs.webkit.org/show_bug.cgi?id=295888

Reviewed by Eric Carlson.

We fire devicechange events on iOS due to thinking that there are changes of 
default microphone, while there is no real change in two cases.

The first case is the following:
- The device has one microphone. When capturing, it is set as default. When not 
capturing, there is no default device.
Before the patch, given there is a change of isDefault(), we would fire the 
devicechange event, even though the exposed list of devices would remain 
exactly the same.
To prevent this, we are now checking the final list of microphones and 
speakers. If they are exactly the same, we do not trigger a devicechange event.

The second case is the following:
- The device has a built-in microphone and another microphone say AirPods. 
AirPods are second in the list provided by the OS but will be used as the 
default microphone.
When not capturing, there is no default device in the list, so the first 
microphone in the list becomes the de facto default.
When capturing, there is a default device in the list, which is the second 
microphone in the list.

When capture starts, we would set AirPods as the default device and fire a 
devicechange event.
When capture stops, we would no longer see any default device and the first 
microphone in the list would become the new default.

To prevent the devicechange event to fire when capture stops, we do not 
consider that devices change in the case that:
- The list of devices is the same
- The old list of devices had a default and the new list of devices have no 
default.

Manually tested on iOS.

* Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
(WebCore::AVAudioSessionCaptureDeviceManager::setAudioCaptureDevices):

Canonical link: https://commits.webkit.org/298074@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to