Title: [288275] trunk/Source/WebCore
- Revision
- 288275
- Author
- [email protected]
- Date
- 2022-01-20 00:36:27 -0800 (Thu, 20 Jan 2022)
Log Message
AVAudioSessionCaptureDeviceManager is not always computing the right default input device
https://bugs.webkit.org/show_bug.cgi?id=235362
<rdar://87707090>
Reviewed by Eric Carlson.
Sometimes the defaultInput is not available, in which case it is good to resort to the previous default device if available.
This fix prevents the following case to happen:
- We start rendering WebRTC audio on some output, say AirPods
- We start capturing microphone, but the default microphone is not the AirPods one (while it probably should, this is not always the case).
- We migrate audio rendering to VPIO which will output audio to the same device as the input microphone if feasible (typically builtin speaker).
- Audio is now flowing on builtin speaker instead of AirPods.
Manually tested.
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (288274 => 288275)
--- trunk/Source/WebCore/ChangeLog 2022-01-20 08:31:28 UTC (rev 288274)
+++ trunk/Source/WebCore/ChangeLog 2022-01-20 08:36:27 UTC (rev 288275)
@@ -1,3 +1,23 @@
+2022-01-20 Youenn Fablet <[email protected]>
+
+ AVAudioSessionCaptureDeviceManager is not always computing the right default input device
+ https://bugs.webkit.org/show_bug.cgi?id=235362
+ <rdar://87707090>
+
+ Reviewed by Eric Carlson.
+
+ Sometimes the defaultInput is not available, in which case it is good to resort to the previous default device if available.
+ This fix prevents the following case to happen:
+ - We start rendering WebRTC audio on some output, say AirPods
+ - We start capturing microphone, but the default microphone is not the AirPods one (while it probably should, this is not always the case).
+ - We migrate audio rendering to VPIO which will output audio to the same device as the input microphone if feasible (typically builtin speaker).
+ - Audio is now flowing on builtin speaker instead of AirPods.
+
+ Manually tested.
+
+ * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
+ * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
+
2022-01-19 Simon Fraser <[email protected]>
<dialog> with transformed ancestor asserts under RenderGeometryMap
Modified: trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h (288274 => 288275)
--- trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h 2022-01-20 08:31:28 UTC (rev 288274)
+++ trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h 2022-01-20 08:36:27 UTC (rev 288275)
@@ -33,6 +33,7 @@
#include <wtf/WorkQueue.h>
OBJC_CLASS AVAudioSession;
+OBJC_CLASS AVAudioSessionPortDescription;
OBJC_CLASS WebAVAudioSessionAvailableInputsListener;
namespace WebCore {
@@ -83,6 +84,7 @@
AudioSessionState m_audioSessionState { AudioSessionState::NotNeeded };
String m_preferredAudioDeviceUID;
bool m_recomputeDevices { true };
+ mutable RetainPtr<AVAudioSessionPortDescription> m_lastDefaultMicrophone;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm (288274 => 288275)
--- trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm 2022-01-20 08:31:28 UTC (rev 288274)
+++ trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm 2022-01-20 08:36:27 UTC (rev 288275)
@@ -237,6 +237,12 @@
Vector<AVAudioSessionCaptureDevice> AVAudioSessionCaptureDeviceManager::retrieveAudioSessionCaptureDevices() const
{
auto *defaultInput = [m_audioSession currentRoute].inputs.firstObject;
+ if (!defaultInput)
+ defaultInput = m_lastDefaultMicrophone.get();
+ else {
+ RELEASE_LOG_INFO(WebRTC, "AVAudioSessionCaptureDeviceManager using previous default input");
+ m_lastDefaultMicrophone = defaultInput;
+ }
auto availableInputs = [m_audioSession availableInputs];
Vector<AVAudioSessionCaptureDevice> newAudioDevices;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes