Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f8af49f640cc922f066d0e349ff119a5ea6a7eb2
      
https://github.com/WebKit/WebKit/commit/f8af49f640cc922f066d0e349ff119a5ea6a7eb2
  Author: Youenn Fablet <[email protected]>
  Date:   2025-11-17 (Mon, 17 Nov 2025)

  Changed paths:
    A LayoutTests/fast/mediastream/multi-microphone-expected.txt
    A LayoutTests/fast/mediastream/multi-microphone.html
    M LayoutTests/http/tests/media/media-stream/enumerate-devices-source-id.html
    M LayoutTests/platform/glib/TestExpectations
    M Source/WebCore/platform/mediastream/mac/BaseAudioCaptureUnit.cpp
    M Source/WebCore/platform/mediastream/mac/BaseAudioCaptureUnit.h
    M Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp
    M Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h
    M Source/WebCore/platform/mediastream/mac/CoreAudioCaptureUnit.cpp
    M Source/WebCore/platform/mediastream/mac/CoreAudioCaptureUnit.h
    M Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp
    M Source/WebKit/GPUProcess/webrtc/UserMediaCaptureManagerProxy.cpp
    M Source/WebKit/GPUProcess/webrtc/UserMediaCaptureManagerProxy.h

  Log Message:
  -----------
  [macOS] Allow multi-microphone capture
rdar://163945062
https://bugs.webkit.org/show_bug.cgi?id=301870

Reviewed by Jean-Yves Avenard.

On macOS, only one VPIO unit can run at a time.
This means that we can capture with echo cancellation only one microphone at a 
time.
To support multi-capture, we do the following heuristic:
1. Whenever getUserMedia is called by default, echo cancellation remains on by 
default except if web page explicitly asks for echo cancellation to be turned 
on.
2. If starting to capture with echo cancellation, and VPIO is not in use, 
business is done as usual: the CoreAudioCaptureUnit::defaultSingleton() is used 
as normal.
3. If starting to capture with echo cancellation, and VPIO is in use, the 
CoreAudioCaptureSource(s) using the CoreAudioCaptureUnit::defaultSingleton() 
are migrated to a non VPIO HAL unit.
   This is being exposed to the web page by firing configurationchange event on 
the track.
   The new capture will start with echo cancellation on.

To implement this heurisitc, we add a willChangeCaptureDeviceTo callback from 
CoreAudioCaptureUnit to CoreAudioCaptureSource.
We reuse the same approach as the applyConstraints code path, except if the 
source is not capturing, in which case we ignore the change.

On iOS, CoreAudioCaptureUnit::defaultSingleton() is still in use and 
responsible to change between VPIO and RemoteIO unit.
To make this clearer, CoreAudioCaptureUnit::setEnableEchoCancellation is now 
only defined in IOS.

To support testing with mocks, we add a second device that supports w/o echo 
cancellation.

Covered by added test.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to