feat: offer both screens and windows in the Wayland portal picker - #264
Open
B077AS wants to merge 1 commit into
Open
feat: offer both screens and windows in the Wayland portal picker#264B077AS wants to merge 1 commit into
B077AS wants to merge 1 commit into
Conversation
Use DesktopCapturer::CreateGenericCapturer (CaptureType::kAnyScreenContent, the same type Chromium uses for getDisplayMedia) when running under Wayland with PipeWire, so the xdg-desktop-portal dialog shows both the monitor and the application window tabs. Falls back to the type-specific capturers when the generic capturer is unavailable (X11, Windows, macOS unchanged).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Under Wayland the
xdg-desktop-portalscreen-cast dialog only offered thesource kind that matched the capturer we created:
CreateScreenCapturershowed just the monitor list,
CreateWindowCapturerjust the window list.A user picking "share a window" from a screen-capture entry point (or vice
versa) had no way to get there.
This routes the Wayland/PipeWire path through
DesktopCapturer::CreateGenericCapturer, which requestsCaptureType::kAnyScreenContent— the same capture type Chromium uses forgetDisplayMedia. The portal then presents both the monitor and theapplication-window tabs in a single dialog and the user chooses.
Details
WEBRTC_USE_PIPEWIREis defined.CreateGenericCapturerreturnsnullwhen not running under Wayland orwhen PipeWire is disallowed; in that case the code falls back to the
existing type-specific
CreateWindowCapturer/CreateScreenCapturerbased on
sourceIsWindow, so X11, Windows and macOS behaviour isunchanged.
DesktopAndCursorComposer, asbefore.
dialog, so
sourceIsWindowis not consulted there.Files
webrtc-jni/src/main/cpp/src/media/video/VideoTrackDesktopSource.cppTesting
and "Window" tabs; sharing a monitor and sharing a window both work.