Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserMediaCaptureManagerProxy should allow reusing any camera source of the same page #1471

Conversation

youennf
Copy link
Contributor

@youennf youennf commented Jun 13, 2022

95440b3

UserMediaCaptureManagerProxy should allow reusing any camera source of the same page
https://bugs.webkit.org/show_bug.cgi?id=241548
rdar://problem/95091899

Patch by Youenn Fablet <youennf@gmail.com > on 2022-06-14
Reviewed by Eric Carlson.

We are trying to reuse an existing camera source but we were only storing one camera source.
This does not work well in case the camera source gets cloned and then ended.
What we need to do is store all sources and if one is reusable, use it.

We use a WeakHashSet to store all camera sources (through getUserMedia or clone)
and iterate on them to either reuse and if not possible stop them.

This also ensures that a page does not have two live AVVideoCaptureSource sources.
If we had that, one source would interrupt the other and vice versa.

Fix a bug in which a cloned track would not have its PageIdentifier.

* Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::createCameraSource):
(WebKit::UserMediaCaptureManagerProxy::clone):
* Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
* Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
* Source/WebKit/WebProcess/cocoa/RemoteRealtimeMediaSourceProxy.cpp:
(WebKit::RemoteRealtimeMediaSourceProxy::createRemoteCloneSource):
* Source/WebKit/WebProcess/cocoa/RemoteRealtimeMediaSourceProxy.h:
* Source/WebKit/WebProcess/cocoa/RemoteRealtimeVideoSource.cpp:
(WebKit::RemoteRealtimeVideoSource::clone):

Canonical link: https://commits.webkit.org/251529@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295524 268f45cc-cd09-0410-ab3c-d52691b4dbfc

@webkit-early-warning-system webkit-early-warning-system added the merging-blocked Applied to prevent a change from being merged label Jun 13, 2022
@youennf youennf force-pushed the eng/UserMediaCaptureManagerProxy-should-allow-reusing-any-camera-source-of-the-same-page branch 2 times, most recently from 6a6d616 to e7a4882 Compare June 14, 2022 08:59
@youennf youennf added merge-queue Applied to send a pull request to merge-queue WebRTC For bugs in WebRTC and removed merging-blocked Applied to prevent a change from being merged labels Jun 14, 2022
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/UserMediaCaptureManagerProxy-should-allow-reusing-any-camera-source-of-the-same-page branch from e7a4882 to 95440b3 Compare June 14, 2022 16:22
@webkit-early-warning-system webkit-early-warning-system merged commit 95440b3 into WebKit:main Jun 14, 2022
@webkit-early-warning-system
Copy link
Collaborator

Committed r295524 (251529@main): https://commits.webkit.org/251529@main

Reviewed commits have been landed. Closing PR #1471 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system removed the merge-queue Applied to send a pull request to merge-queue label Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebRTC For bugs in WebRTC
Projects
None yet
3 participants