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

fix: use generic capturer to list both screens and windows when possible #39111

Merged
merged 1 commit into from Jul 21, 2023

Conversation

aiddya
Copy link
Contributor

@aiddya aiddya commented Jul 15, 2023

Description of Change

Screensharing with PipeWire via XDG Desktop Portal requires explicit user permission via permission dialogs. Chromium has separate tabs for screens and windows and thus its portal implementation requests permissions separately for each. However, the screencast portal has no such limitation and supports both screens and windows in a single request.

WebRTC now supports this type of capture in a new method called CreateGenericCapturer. The desktopCapturer implementation has been modified to use it. Additionally, Chromium has been patched to use same generic capturer to ensure that the source IDs remain valid for getUserMedia.

Fixes #39043

Checklist

Release Notes

Notes: Fixed a redundant permission popup while fetching screens and windows using desktopCapturer.getSources() on Wayland.

@aiddya aiddya requested a review from a team as a code owner July 15, 2023 16:50
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jul 15, 2023
Copy link
Member

@VerteDinde VerteDinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good to me, but I think we need to resolve a patch - would you mind rebasing with main and resolving that patch conflict, and I'll review?

Also, if it's not too much trouble, you mention in the PR description backporting a fix from WebRTC. Would you mind linking to the CL of that upstream backport in the patch description or the PR description? That will just help us remove the patch when it eventually lands in main, without accidentally removing some needed code 🙂 Thanks again for this fix!

@aiddya
Copy link
Contributor Author

aiddya commented Jul 20, 2023

@VerteDinde I've rebased and resolved the patch conflict. One of the Chromium updates pushed after I created this PR has brought in the backported WebRTC patch. It was the cause of the conflict and I've removed it.

On the other hand, this means that I'll have to backport the PR manually to 26.x.y 😞. I'll add the CL details in the backport PR.

Screensharing with PipeWire via XDG Desktop Portal requires explicit
user permission via permission dialogs. Chromium has separate tabs for
screens and windows and thus its portal implementation requests
permissions separately for each. However, the screencast portal has no
such limitation and supports both screens and windows in a single
request.

WebRTC now supports this type of capture in a new method called
called `CreateGenericCapturer`. The `desktopCapturer` implementation has
been modified to use it. Additionally, Chromium has been patched to use
same generic capturer to ensure that the source IDs remain valid for
`getUserMedia`.
@VerteDinde VerteDinde added semver/patch backwards-compatible bug fixes target/26-x-y PR should also be added to the "26-x-y" branch. labels Jul 21, 2023
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Jul 21, 2023
@VerteDinde VerteDinde merged commit 9cd5de7 into electron:main Jul 21, 2023
15 checks passed
@release-clerk
Copy link

release-clerk bot commented Jul 21, 2023

Release Notes Persisted

Fixed a redundant permission popup while fetching screens and windows using desktopCapturer.getSources() on Wayland.

@trop
Copy link
Contributor

trop bot commented Jul 21, 2023

I have automatically backported this PR to "26-x-y", please check out #39189

@trop trop bot added in-flight/26-x-y and removed target/26-x-y PR should also be added to the "26-x-y" branch. labels Jul 21, 2023
@VerteDinde
Copy link
Member

@aiddya Our automation opened a backport automatically - if you want, happy to manually backport the CL to it myself if you wouldn't mind linking me the relevant CL. Otherwise, I'll close the automated backport and let you open a manual backport 🙇‍♀️

@aiddya
Copy link
Contributor Author

aiddya commented Jul 21, 2023

@VerteDinde That would be great, thanks! Here's the CL: https://webrtc-review.googlesource.com/c/src/+/311549

@aiddya
Copy link
Contributor Author

aiddya commented Aug 2, 2023

@VerteDinde Is this backportable to stable branches?

I've noticed that the double permission dialogs sometimes cause focus bugs, where one dialog is perfectly superimposed on the other, but the bottom one has focus. The top dialog is not clickable, which leaves the impression that the application has frozen.

I want to backport this to 25-x-y and perhaps 24-x-y too. The double permission dialogs were introduced by #38833, so the backport can be seen as a fixup.

@trop
Copy link
Contributor

trop bot commented Sep 1, 2023

@aiddya has manually backported this PR to "25-x-y", please check out #39710

@trop
Copy link
Contributor

trop bot commented Sep 1, 2023

@aiddya has manually backported this PR to "24-x-y", please check out #39711

@trop trop bot added the in-flight/24-x-y label Sep 1, 2023
VerteDinde added a commit that referenced this pull request Sep 12, 2023
@trop trop bot added merged/25-x-y PR was merged to the "25-x-y" branch. merged/24-x-y PR was merged to the "24-x-y" branch and removed in-flight/25-x-y in-flight/24-x-y labels Sep 25, 2023
MrHuangJser pushed a commit to MrHuangJser/electron that referenced this pull request Dec 11, 2023
…ble (electron#39111)

Screensharing with PipeWire via XDG Desktop Portal requires explicit
user permission via permission dialogs. Chromium has separate tabs for
screens and windows and thus its portal implementation requests
permissions separately for each. However, the screencast portal has no
such limitation and supports both screens and windows in a single
request.

WebRTC now supports this type of capture in a new method called
called `CreateGenericCapturer`. The `desktopCapturer` implementation has
been modified to use it. Additionally, Chromium has been patched to use
same generic capturer to ensure that the source IDs remain valid for
`getUserMedia`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged/24-x-y PR was merged to the "24-x-y" branch merged/25-x-y PR was merged to the "25-x-y" branch. merged/26-x-y PR was merged to the "26-x-y" branch. semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Use combined PipeWire Picker for desktopCapturer when windows and screens are requested
2 participants