Bug 450840 - Screen sharing needs additional chromium options
Summary: Screen sharing needs additional chromium options
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: webenginepart (show other bugs)
Version: Git
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-25 20:15 UTC by Antonio Rojas
Modified: 2022-03-20 21:17 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch to enable WebRTCPipeWireCapturer flag (1.38 KB, patch)
2022-03-06 09:44 UTC, Stefano Crocco
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Antonio Rojas 2022-02-25 20:15:59 UTC
SUMMARY
Screen sharing on Wayland doesn't work out of the box, since the WebRTCPipeWireCapturer chromium options is disabled by default.

STEPS TO REPRODUCE
1. Go to https://mozilla.github.io/webrtc-landing/gum_test.html
2. Click "Screen capture" and accept permissions

OBSERVED RESULT
Black screen

EXPECTED RESULT
Screen is shared

Setting the env variable QTWEBENGINE_CHROMIUM_FLAGS="--enable-features=WebRTCPipeWireCapturer" makes it work.
Note that QtWebengine crashes when compiled with pipewire 0.2 if the compositor is running a recent pipewire version, so in order to test this a patched QtWebengine is probably needed (such as the one shipped by Arch Linux or Flathub)
Comment 1 Stefano Crocco 2022-02-28 16:40:30 UTC
Unfortunately, I don't use neither Wayland nor pipewire, so I couldn't test your suggestion. I tried running Konqueror in Wayland and, as you say, the test page doesn't work. However, the same happens when setting the environment variable you suggested. Maybe this is related to what you say about a patched QtWebEngine. I'm on Gentoo, and when I tried to enable pipewire, it didn't ask to recompile it. If that's the case, I  can try recompiling it myself, but since I can't see in my package manager an option to enable pipewire support in it, I doubt it'll change anything. Since compiling QtWebEngine takes quite a while, I'm not sure when I'll have time to do it. Do you have any more information on what patches ArchLinux apply to their QtWebEngine?
Comment 2 Antonio Rojas 2022-02-28 20:02:29 UTC
It looks like gentoo doesn't enable pipewire screen share at all [1]. It needs the qmake flag -webengine-webrtc-pipewire. Additionally, as I mentioned, it needs a patch [2] to use pipewire 0.3, otherwise it will simply crash. For reference, this is the relevant code in Qutebrowser, where this works properly [3].

[1] https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-qt/qtwebengine/qtwebengine-5.15.2_p20211216.ebuild
[2] https://github.com/archlinux/svntogit-packages/blob/packages/qt5-webengine/trunk/qt5-webengine-pipewire-0.3.patch
[3] https://github.com/qutebrowser/qutebrowser/blob/4435ef928796fa744be5452924a103bb2e58ee8e/qutebrowser/config/qtargs.py#L128
Comment 3 Stefano Crocco 2022-03-06 09:44:55 UTC
Created attachment 147318 [details]
Patch to enable WebRTCPipeWireCapturer flag
Comment 4 Stefano Crocco 2022-03-06 09:45:05 UTC
I tried applying the patch you provided to QtWebEngine, but nothing changed. Is there any chance you can compile Konqueror yourself applying the attached patch and test if it works?
Comment 5 Antonio Rojas 2022-03-06 10:13:51 UTC
(In reply to Stefano Crocco from comment #4)
> I tried applying the patch you provided to QtWebEngine, but nothing changed.
> Is there any chance you can compile Konqueror yourself applying the attached
> patch and test if it works?

Everything works fine with the patch, thanks
Comment 6 Bug Janitor Service 2022-03-06 17:19:45 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/konqueror/-/merge_requests/113
Comment 7 David Faure 2022-03-19 23:12:15 UTC
Git commit 0f360fad77e1dd88ab141e18d0819cf99b417928 by David Faure, on behalf of Stefano Crocco.
Committed on 19/03/2022 at 23:07.
Pushed by dfaure into branch 'master'.

Enable WebRTCPipeWireCapturer feature for QtWebEngine

This is needed to have screen capture on Wayland using pipewire. It's
optional because it crashes with pipewire-3 unless using a patched
version of QtWebEngine

M  +7    -0    CMakeLists.txt
M  +4    -0    src/konqapplication.cpp

https://invent.kde.org/network/konqueror/commit/0f360fad77e1dd88ab141e18d0819cf99b417928
Comment 8 Stefano Crocco 2022-03-20 21:17:42 UTC
Git commit 93a1b098cad3e83afeba467d8528c19edfe000b5 by Stefano Crocco.
Committed on 20/03/2022 at 21:18.
Pushed by stefanocrocco into branch 'release/22.04'.

Enable WebRTCPipeWireCapturer feature for QtWebEngine

This is needed to have screen capture on Wayland using pipewire. It's
optional because it crashes with pipewire-3 unless using a patched
version of QtWebEngine
(cherry picked from commit 0f360fad77e1dd88ab141e18d0819cf99b417928)

M  +7    -0    CMakeLists.txt
M  +4    -0    src/konqapplication.cpp

https://invent.kde.org/network/konqueror/commit/93a1b098cad3e83afeba467d8528c19edfe000b5