RESOLVED FIXED220010
[iOS] Do extensive search for microphone devices when trying to capture
https://bugs.webkit.org/show_bug.cgi?id=220010
Summary [iOS] Do extensive search for microphone devices when trying to capture
youenn fablet
Reported 2020-12-18 00:42:35 PST
[iOS] Do extensive search for microphone devices when trying to capture. Currently, we do an extensive search immediately when enumerateDevices is called. It is better to wait for getUserMedia calls.
Attachments
Patch (13.45 KB, patch)
2020-12-18 03:19 PST, youenn fablet
ews-feeder: commit-queue-
Patch (13.32 KB, patch)
2020-12-18 03:29 PST, youenn fablet
no flags
Patch (13.55 KB, patch)
2020-12-18 04:53 PST, youenn fablet
no flags
Patch (14.39 KB, patch)
2020-12-18 09:22 PST, youenn fablet
no flags
Patch (15.42 KB, patch)
2020-12-18 10:10 PST, youenn fablet
no flags
Updated patch (24.08 KB, patch)
2020-12-18 17:02 PST, Eric Carlson
no flags
Updated patch (24.19 KB, patch)
2020-12-18 17:12 PST, Eric Carlson
no flags
Patch (19.05 KB, patch)
2020-12-21 06:58 PST, youenn fablet
no flags
youenn fablet
Comment 1 2020-12-18 03:19:55 PST
youenn fablet
Comment 2 2020-12-18 03:29:25 PST
youenn fablet
Comment 3 2020-12-18 04:53:00 PST
youenn fablet
Comment 4 2020-12-18 09:22:10 PST
youenn fablet
Comment 5 2020-12-18 10:10:39 PST
Peng Liu
Comment 6 2020-12-18 10:51:36 PST
Comment on attachment 416527 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416527&action=review > Source/WebKit/ChangeLog:10 > + exhaustive audio device query if no other page is needed it. s/is needed/needs/
Eric Carlson
Comment 7 2020-12-18 11:11:35 PST
Comment on attachment 416527 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416527&action=review > Source/WebCore/ChangeLog:8 > + Extensive audio device query needs to enable the AudioSession. s/needs to enable the AudioSession/needs to have an active AudioSession/ > Source/WebCore/ChangeLog:10 > + To work around these side effects, we add an API that allows to control whether activating the audio session or not. s/control whether activating the audio session or not/control whether the AudioSession is active or not/ > Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:219 > + RELEASE_LOG_ERROR(WebRTC, "Failed to disactivate audio session with error: %@.", error.localizedDescription); s/disactivate/deactivate/
Eric Carlson
Comment 8 2020-12-18 16:58:43 PST
Eric Carlson
Comment 9 2020-12-18 17:02:27 PST
Created attachment 416559 [details] Updated patch
Eric Carlson
Comment 10 2020-12-18 17:12:53 PST
Created attachment 416560 [details] Updated patch
youenn fablet
Comment 11 2020-12-21 02:30:06 PST
Comment on attachment 416560 [details] Updated patch View in context: https://bugs.webkit.org/attachment.cgi?id=416560&action=review > Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.h:290 > +#define AVAudioSessionModeVideoRecording PAL::get_AVFoundation_AVAudioSessionModeVideoRecording() Unclear why we want this change. > Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.mm:216 > +SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVAudioSessionModeVideoRecording, NSString *, PAL_EXPORT) Unclear why we want this change. > Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:92 > + dispatch_async(m_dispatchQueue, makeBlockPtr([this, locker = holdLock(m_lock)] { Sounds good enough for now. We might want to document this in ChangeLog though. Ideally, we would use a completion handler. > Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:104 > + RELEASE_LOG_ERROR(WebRTC, "Failed to set audio session category with error: %@.", error.localizedDescription); In theory, we could release the dispatch queue once we are done there. > Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:160 > + auto locker = holdLock(m_lock); We could reduce the time where we hold the lock by doing { auto locker = holdLock(m_lock); } > Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:163 > + do { I do not think we want this do loop here since we are locking above.
youenn fablet
Comment 12 2020-12-21 06:58:58 PST
EWS
Comment 13 2020-12-22 02:11:49 PST
Committed r271049: <https://trac.webkit.org/changeset/271049> All reviewed patches have been landed. Closing bug and clearing flags on attachment 416599 [details].
Note You need to log in before you can comment on or make changes to this bug.