RESOLVED FIXED 222166
Update camera and microphone capture state control WKWebView API
https://bugs.webkit.org/show_bug.cgi?id=222166
Summary Update camera and microphone capture state control WKWebView API
youenn fablet
Reported 2021-02-19 06:16:44 PST
Update camera and microphone capture state control WKWebView API
Attachments
Patch (50.00 KB, patch)
2021-02-19 06:27 PST, youenn fablet
ews-feeder: commit-queue-
Patch (49.71 KB, patch)
2021-02-19 06:33 PST, youenn fablet
no flags
Patch (49.73 KB, patch)
2021-02-19 08:23 PST, youenn fablet
no flags
Rebasing (50.57 KB, patch)
2021-03-04 05:45 PST, youenn fablet
no flags
youenn fablet
Comment 1 2021-02-19 06:27:28 PST
youenn fablet
Comment 2 2021-02-19 06:33:03 PST
youenn fablet
Comment 3 2021-02-19 08:23:57 PST
Eric Carlson
Comment 4 2021-02-19 08:38:50 PST
Comment on attachment 420962 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=420962&action=review > Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:524 > +static inline bool trackMatchesKind(RealtimeMediaSource::Type type, MediaProducer::MediaCaptureKind kind) Nit: `trackMatchesKind` is slightly awkward. Maybe `isKindOfTrack`, or `isTypeOfTrack` instead? > Source/WebCore/page/MediaProducer.h:72 > + enum class MediaCaptureKind { Nit: `Kind` doesn't seem right. RealtimeMediaSource's `Type` is analogous, so how about `MediaCaptureType`? > Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:1741 > + auto mutedState = _page->mutedStateFlags(); I think `pageMutedState` would make the logic easier to follow. > Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:1745 > + mutedState = WebCore::MediaProducer::AudioCaptureIsMuted; Don't you want to just add the muted flag: `mutedState |= WebCore::MediaProducer::AudioCaptureIsMuted`? > Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:1747 > + _page->setMuted(mutedState, [completionHandler = makeBlockPtr(completionHandler)] { > + completionHandler(); If the page microphone capture state is already already muted, why not just call the completion handler immediately and return? > Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:1766 > + auto mutedState = _page->mutedStateFlags(); > + if (state == _WKMediaCaptureStateActive && mutedState & WebCore::MediaProducer::VideoCaptureIsMuted) > + mutedState ^= WebCore::MediaProducer::VideoCaptureIsMuted; > + else if (state == _WKMediaCaptureStateMuted) > + mutedState = WebCore::MediaProducer::VideoCaptureIsMuted; > + _page->setMuted(mutedState, [completionHandler = makeBlockPtr(completionHandler)] { > + completionHandler(); > + }); Ditto the comments above. > Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm:159 > +void PageClientImplCocoa::microphoneCaptureChanged() > +{ > + [m_webView didChangeValueForKey:@"_microphoneCaptureState"]; > +} > + > +void PageClientImplCocoa::cameraCaptureChanged() s/*CaptureChanged/*CaptureStateChanged/
Radar WebKit Bug Importer
Comment 5 2021-02-26 06:17:14 PST
youenn fablet
Comment 6 2021-03-04 04:58:34 PST
Comment on attachment 420971 [details] Patch win failure unrelated
EWS
Comment 7 2021-03-04 04:59:22 PST
Tools/Scripts/svn-apply failed to apply attachment 420971 [details] to trunk. Please resolve the conflicts and upload a new patch.
youenn fablet
Comment 8 2021-03-04 05:45:19 PST
Created attachment 422218 [details] Rebasing
EWS
Comment 9 2021-03-04 08:44:21 PST
Committed r273891: <https://commits.webkit.org/r273891> All reviewed patches have been landed. Closing bug and clearing flags on attachment 422218 [details].
Note You need to log in before you can comment on or make changes to this bug.