Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 8bc8b76f63733d530c74a3cb99090bed2a014720 https://github.com/WebKit/WebKit/commit/8bc8b76f63733d530c74a3cb99090bed2a014720 Author: Youenn Fablet <you...@apple.com> Date: 2024-12-14 (Sat, 14 Dec 2024)
Changed paths: M Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp M Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm M Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.h M Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm M Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.cpp M Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.h M Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDevice.cpp M Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDevice.h M Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp M Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h M Source/WebCore/platform/mediastream/mac/CoreAudioSharedUnit.cpp Log Message: ----------- [iOS] Do not set a microphone as preferred if getUserMedia is not asking for a specific device rdar://140384961 https://bugs.webkit.org/show_bug.cgi?id=284617 Reviewed by Eric Carlson. When capturing microphone on iOS, we were setting preferred microphone on the AudioSession. This sometimes seems to interfere with smart routing, in particular with AirPods. To prevent this, in UIProcess, we are checking the constraints to see whether the web page asked for a specific device. If not, we are marking the CaptureDevice as 'default'. We send the CaptureDevice to GPUProcess and CoreAudioCaptureSource will let know CoreAudioSharedUnit whether the device to use is the default one. If it is not the default, we continue setting the preferred microphone on the AudioSession. Otherwise, we set it to nil so that the OS is free to select whichever microphone is best suited. Manually tested on https://webrtc.github.io/samples/src/content/devices/input-output/ in a setup with AirPods. AirPods would be initially selected as the page is requesting any microphone. Then, within the page, by selecting either built-in microphone or AirPods, the microphone (and speaker route) should follow. We do a minor refactoring to CoreAudioCaptureDevice by removing the unused deviceClock method and related member. We do a minor refactoring of CoreAudioCaptureSourceFactoryIOS since its createAudioCaptureSource method is the same as the base one. We update CoreAudioCaptureSourceFactory::createAudioCaptureSource and CoreAudioCaptureSource::create so that CoreAudioCaptureSource constructor gets the device sent from UIProcess. This ensures that we keep whether the device to be used is the default or not. * Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp: (WebCore::RealtimeMediaSourceCenter::getUserMediaDevices): * Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm: (WebCore::AVAudioSessionCaptureDeviceManager::setPreferredAudioSessionDeviceUIDInternal): * Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.h: * Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm: (WebCore::CoreAudioCaptureSourceFactoryIOS::createAudioCaptureSource): Deleted. * Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.cpp: (WebCore::BaseAudioSharedUnit::setCaptureDevice): * Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.h: (WebCore::BaseAudioSharedUnit::isCapturingWithDefaultMicrophone const): * Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDevice.cpp: (WebCore::CoreAudioCaptureDevice::deviceClock): Deleted. * Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDevice.h: (WebCore::CoreAudioCaptureDevice::deviceID const): * Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp: (WebCore::CoreAudioCaptureSource::create): (WebCore::CoreAudioCaptureSource::initializeToStartProducingData): * Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h: (WebCore::CoreAudioCaptureSourceFactory::createAudioCaptureSource): * Source/WebCore/platform/mediastream/mac/CoreAudioSharedUnit.cpp: (WebCore::CoreAudioSharedUnit::captureDeviceChanged): (WebCore::CoreAudioSharedUnit::migrateToNewDefaultDevice): Canonical link: https://commits.webkit.org/287834@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