[Bug 268726] www/chromium: enable PipeWire support (screen capture under Wayland)

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 03 Jan 2023 05:09:41 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268726

            Bug ID: 268726
           Summary: www/chromium: enable PipeWire support (screen capture
                    under Wayland)
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: chromium@FreeBSD.org
          Reporter: jbeich@FreeBSD.org
             Flags: maintainer-feedback?(chromium@FreeBSD.org)
          Assignee: chromium@FreeBSD.org

Created attachment 239219
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=239219&action=edit
unconditional (rtc_link_pipewire=false)

PipeWire-based screen capture is complex replacement[1] for
wlr-screencopy-unstable-v1 (wlroots, MirServer >= 2.8, to be standardized[2]),
primarily designed for sandboxing apps via Flatpak or similar. It can work
under both X11 and Wayland but most consumers limit it to Wayland. See also
other xdg-desktop-portal examples:
- org.freedesktop.portal.ScreenCast: firefox-esr, obs-studio, kooha
- org.freedesktop.portal.Screenshot: flameshot, ksnip, gimp-app

This expands ports 8fc70d7e9054 to include Screen Capture in WebRTC. With
rtc_link_pipewire=false (upstream default) libpipewire is used via dlopen(3),
so it can always be enabled like Wayland support.

"poudriere bulk -t" passed on 13.1 amd64. Runtime tested inside 13.1 jail on
14.0 host under Sway with X11/Wayland/DBus sockets passed through. Works fine
both under native Wayland and Xwayland.

Runtime testing recipe:

# pkg install chromium sway pam_xdg xdg-desktop-portal-wlr xdg-desktop-portal
# echo 'session optional pam_xdg.so notroot runtime' >>/etc/pam.d/system
# sysrc seatd_enable=YES
# service seatd start
$ exit # log out to pick up XDG_RUNTIME_DIR
<new login>
$ dbus-daemon --session --fork --address=unix:runtime=yes
$ export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus # workaround
$ sway
<GUI session>
$ export XDG_CURRENT_DESKTOP=sway
$ dbus-update-activation-environment --all
$ daemon -f pipewire
$ daemon -f /usr/local/libexec/xdg-desktop-portal # workaround
$ daemon -f /usr/local/libexec/xdg-desktop-portal-wlr # workaround
$ chrome
- open chrome://flags
- enter "wayland" in Search field
- set "WebRTC PipeWire support" to "Enabled"
- set "Preferred Ozone platform" to "Auto"
- click Relaunch

- open https://mozilla.github.io/webrtc-landing/gum_test.html
- click on "Screen Capture"
- click on "Entire Screen" tab in "Choose what to share" prompt
- click anywhere to select the desired output/monitor
- notice preview is filled with screen content
- click "Share" to confirm
- click anywhere to select the desired output/monitor
- watch screen content mirrored on the web page
- click on "Stop Sharing" to end the capture or just close the browser

References:
[1]
https://blogs.kde.org/2020/10/11/linux-desktop-shell-ipc-wayland-vs-d-bus-and-lack-agreement-when-use-them
[2]
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/124

-- 
You are receiving this mail because:
You are the assignee for the bug.