Github messages for voidlinux
 help / color / mirror / Atom feed
From: Logarithmus <Logarithmus@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
Date: Sat, 21 Nov 2020 02:46:54 +0100	[thread overview]
Message-ID: <20201121014654.8XwflfTjX1RK3e7IyK14nwCL6TUTWE7IvcrAL4Uo6U0@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-26144@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 2687 bytes --]

There is an updated pull request by Logarithmus against master on the void-packages repository

https://github.com/Logarithmus/void-packages libpipewire02
https://github.com/void-linux/void-packages/pull/26144

chromium: enable WebRTC screen sharing via PipeWire
[ci skip]

**UPD**: Chromium 87 has just been released. All the tests were done for Chromium 86, so additional testing is needed now.

- [x] libpipewire0.2
- [x] patch chromium's template
- [x] test for all archs:
    - [ ] x86_64 - works for Chromium 86: https://youtu.be/AgyxEC7SfGk
    - [ ] i686 - works for Chromium 86: https://youtu.be/j0MY9C1CwV4
    - [x] aarch64 - ignoring because `nocross=yes`
    - [x] armv7l - ignoring because `nocross=yes`
    - [x] x86_64-musl - works for Chromium 87: https://youtu.be/ZJorRl_7Sh4
    There are minor issues though:
    * you have to kill `xdg-desktop-portal*` processes sometimes, probably caused by some sort of race condition;
    * also you may need to start/restart screensharing for it to work.
        ✔️ https://www.webrtc-experiment.com/Pluginfree-Screen-Sharing
        ✔️ https://zoom.us (in-browser version)
        ✔️ https://discord.com (in-browser version)
    - [x] aarch64-musl - ignoring because `nocross=yes`

Currently I'm investigating these stability issues with `pipewire`. It seems that `pipewire` is trying to use `rtkit` to make audio/video processing run in real time. Unfortunately, it fails to do so:
```
2020-11-16T03:49:59.73350 daemon.err: Nov 16 03:49:59 rtkit-daemon[3165]: Failed to make ourselves RT: Function not implemented
2020-11-16T03:49:59.73602 daemon.warn: Nov 16 03:49:59 rtkit-daemon[3165]: Warning: failed to read scheduler policy: Function not implemented
2020-11-16T03:49:59.73620 daemon.debug: Nov 16 03:49:59 rtkit-daemon[3165]: Supervising 0 threads of 0 processes of 1 users.
2020-11-16T03:49:59.73645 daemon.debug: Nov 16 03:49:59 rtkit-daemon[3165]: Supervising 0 threads of 0 processes of 1 users.
2020-11-16T03:49:59.74118 daemon.err: Nov 16 03:49:59 rtkit-daemon[3165]: Failed to make ourselves RT: Function not implemented
```
After a bit of searching, I've found these bugs:
https://bugzilla.redhat.com/show_bug.cgi?id=1229700
https://bugs.gentoo.org/show_bug.cgi?id=569546

I've built `linux5.9` for `x86_64` with `CONFIG_RT_GROUP_SCHED` disabled.
For some strange reason, nothing changed, the error persists. Luckily, screen sharing works without `rtkit`.
I guess that those rare issues with screen sharing, which were described above, may be caused by `rtkit` not working. 

A patch file from https://github.com/void-linux/void-packages/pull/26144.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libpipewire02-26144.patch --]
[-- Type: text/x-diff, Size: 10280 bytes --]

From caba9b10036722b0f62b9b288a16f8a6f751f965 Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Wed, 4 Nov 2020 02:42:23 +0300
Subject: [PATCH 1/4] New package: libpipewire0.2

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 36 +++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 120000 srcpkgs/libpipewire0.2-devel
 create mode 100644 srcpkgs/libpipewire0.2/template

diff --git a/srcpkgs/libpipewire0.2-devel b/srcpkgs/libpipewire0.2-devel
new file mode 120000
index 00000000000..456616f84ec
--- /dev/null
+++ b/srcpkgs/libpipewire0.2-devel
@@ -0,0 +1 @@
+libpipewire0.2
\ No newline at end of file
diff --git a/srcpkgs/libpipewire0.2/template b/srcpkgs/libpipewire0.2/template
new file mode 100644
index 00000000000..62c18860c00
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,36 @@
+# Template file for 'libpipewire0.2'
+pkgname=libpipewire0.2
+version=0.2.7
+revision=1
+wrksrc=pipewire-${version}
+build_style=meson
+configure_args="-Dgstreamer=disabled -Ddocs=false -Dsystemd=false"
+hostmakedepends="pkg-config"
+makedepends="dbus-devel alsa-lib-devel libudev-devel"
+short_desc="Server and user space API to deal with multimedia pipelines (v0.2)"
+maintainer="Artur Sinila <opensource@logarithmus.dev>"
+license="MIT"
+homepage="https://pipewire.org/"
+changelog="https://gitlab.freedesktop.org/pipewire/pipewire/-/raw/master/NEWS"
+distfiles="https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/${version}/pipewire-${version}.tar.gz"
+checksum=bfaa0f6ae6c0791e2e0b59234d399753bf24f1b33dbf587682363a8463dd8df1
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

From 05556275e5518e5b1b191430e52c6334da910f67 Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Sat, 21 Nov 2020 03:58:45 +0300
Subject: [PATCH 2/4] common/shlibs: add libpipewire0.2

---
 common/shlibs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/shlibs b/common/shlibs
index 8b31eaafdc4..d8e3ff7f9ff 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -3270,6 +3270,7 @@ libarcan_shmif_ext.so.0.11 arcan-0.5.4.3_1
 libarcan_shmif_server.so.0.11 arcan-0.5.4.3_1
 libarcan_tui.so.0.11 arcan-0.5.4.3_1
 liblwipv6.so.2 lwipv6-1.5a_1
+libpipewire-0.2.so.1 libpipewire0.2-0.2.7_1
 libpipewire-0.3.so.0 libpipewire-0.3.6_1
 libvolk.so.2.2.1 volk-2.2.1_1
 libgnuradio-runtime.so.3.8.0 gnuradio-3.8.0.0_1

From 610859e58e991fb03ec0babf2d43a1a450ae4520 Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Mon, 16 Nov 2020 00:59:09 +0300
Subject: [PATCH 3/4] pipewire: update to 0.3.15, patches for v0.2 compat &
 musl

---
 ...x-pipewire-0.2-clients-like-chromium.patch | 44 +++++++++++++++++++
 .../replace-strndupa-with-alloca.patch        | 31 +++++++++++++
 srcpkgs/pipewire/template                     |  5 ++-
 3 files changed, 78 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/pipewire/patches/fix-pipewire-0.2-clients-like-chromium.patch
 create mode 100644 srcpkgs/pipewire/patches/replace-strndupa-with-alloca.patch

diff --git a/srcpkgs/pipewire/patches/fix-pipewire-0.2-clients-like-chromium.patch b/srcpkgs/pipewire/patches/fix-pipewire-0.2-clients-like-chromium.patch
new file mode 100644
index 00000000000..cccf3902f95
--- /dev/null
+++ b/srcpkgs/pipewire/patches/fix-pipewire-0.2-clients-like-chromium.patch
@@ -0,0 +1,44 @@
+From b8c7b36d3b8be16593f554964cf2f852c21b5c2c Mon Sep 17 00:00:00 2001
+From: Wim Taymans <wtaymans@redhat.com>
+Date: Wed, 4 Nov 2020 16:12:25 +0100
+Subject: [PATCH] protocol-native: do version check on HELLO
+
+Always do the version check on HELLO because the connection could
+have been moved from a v3 portal to a v0 client (like chrome)
+
+Fixes #270
+---
+ src/modules/module-protocol-native/connection.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/src/modules/module-protocol-native/connection.c b/src/modules/module-protocol-native/connection.c
+index 84fad68f..1807833a 100644
+--- src/modules/module-protocol-native/connection.c
++++ src/modules/module-protocol-native/connection.c
+@@ -72,7 +72,6 @@ struct impl {
+ 
+ 	uint32_t version;
+ 	size_t hdr_size;
+-	unsigned int checked:1;
+ };
+ 
+ /** \endcond */
+@@ -319,7 +318,7 @@ static int prepare_packet(struct pw_protocol_native_connection *conn, struct buf
+ 	buf->msg.opcode = p[1] >> 24;
+ 	len = p[1] & 0xffffff;
+ 
+-	if (!impl->checked) {
++	if (buf->msg.id == 0 && buf->msg.opcode == 1) {
+ 		if (p[3] >= 4) {
+ 			pw_log_warn("old version detected");
+ 			impl->version = 0;
+@@ -331,7 +330,6 @@ static int prepare_packet(struct pw_protocol_native_connection *conn, struct buf
+ 		spa_hook_list_call(&conn->listener_list,
+ 				struct pw_protocol_native_connection_events,
+ 				start, 0, impl->version);
+-		impl->checked = 1;
+ 	}
+ 	if (impl->version >= 3) {
+ 		buf->msg.seq = p[2];
+-- 
+GitLab
diff --git a/srcpkgs/pipewire/patches/replace-strndupa-with-alloca.patch b/srcpkgs/pipewire/patches/replace-strndupa-with-alloca.patch
new file mode 100644
index 00000000000..d502fab01cb
--- /dev/null
+++ b/srcpkgs/pipewire/patches/replace-strndupa-with-alloca.patch
@@ -0,0 +1,31 @@
+--- pipewire-pulseaudio/src/stream.c
++++ pipewire-pulseaudio/src/stream.c
+@@ -965,8 +965,12 @@ static int create_stream(pa_stream_direction_t direction,
+            devid &= PA_IDX_MASK_MONITOR;
+
+ 		if (devid == PW_ID_ANY) {
+-			if (pa_endswith(dev, ".monitor"))
+-				dev = strndupa(dev, strlen(dev) - 8);
++			if (pa_endswith(dev, ".monitor")) {
++				char *old = dev;
++				size_t n = strlen(old) - 8;
++				dev = alloca(n);
++				strncpy(dev, old, n);
++			}
+ 		}
+ 	}
+ 
+--- src/modules/module-protocol-pulse/pulse-server.c
++++ src/modules/module-protocol-pulse/pulse-server.c
+@@ -3343,7 +3343,10 @@ static int do_get_info(struct client *client, uint32_t command, uint32_t tag, st
+ 
+ 	if (command == COMMAND_GET_SOURCE_INFO &&
+ 	    sel.value != NULL && pw_endswith(sel.value, ".monitor")) {
+-		sel.value = strndupa(sel.value, strlen(sel.value)-8);
++		char *old = sel.value;
++		size_t n = strlen(old) - 8;
++		sel.value = alloca(n);
++		strncpy(sel.value, old, n);
+ 	}
+ 
+ 	o = select_object(manager, &sel);
diff --git a/srcpkgs/pipewire/template b/srcpkgs/pipewire/template
index 930e4b6a0af..35547be50d9 100644
--- a/srcpkgs/pipewire/template
+++ b/srcpkgs/pipewire/template
@@ -1,6 +1,6 @@
 # Template file for 'pipewire'
 pkgname=pipewire
-version=0.3.12
+version=0.3.15
 revision=1
 build_style=meson
 configure_args="-Dman=true -Dgstreamer=true -Ddocs=true -Dsystemd=false
@@ -9,13 +9,14 @@ configure_args="-Dman=true -Dgstreamer=true -Ddocs=true -Dsystemd=false
 hostmakedepends="doxygen graphviz pkg-config xmltoman"
 makedepends="SDL2-devel ffmpeg-devel gst-plugins-base1-devel jack-devel
  sbc-devel v4l-utils-devel libva-devel libbluetooth-devel"
+depends="rtkit"
 short_desc="Server and user space API to deal with multimedia pipelines"
 maintainer="Kridsada Thanabulpong <sirn@ogsite.net>"
 license="MIT"
 homepage="https://pipewire.org/"
 changelog="https://gitlab.freedesktop.org/pipewire/pipewire/-/raw/master/NEWS"
 distfiles="https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/${version}/pipewire-${version}.tar.gz"
-checksum=98c71228aad2f8443e73a524106f32ca9a74e13c2bf55b65b1e06b72325892cd
+checksum=659bf2baeb5bb783b141b1b9d14da72865d3e84073b3e85503ac119a6813aa2a
 conf_files="/etc/pipewire/pipewire.conf"
 
 if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then

From ef309868d624d8eaa3ac1cb177cec46d8bf74b2c Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Thu, 5 Nov 2020 07:24:27 +0300
Subject: [PATCH 4/4] chromium: enable WebRTC screen sharing via PipeWire [ci
 skip]

---
 srcpkgs/chromium/template | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index b31a09ed1f6..1a77a9f9da7 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -16,12 +16,13 @@ lib32disabled=yes
 nodebug=yes
 nopie=yes  # contains tools that are not PIE, enables PIE itself
 
-build_options="clang js_optimize vaapi pulseaudio sndio"
+build_options="clang js_optimize vaapi pulseaudio sndio pipewire"
 desc_option_clang="Use clang to build"
 desc_option_js_optimize="Optimize the JS used for Chromium's UI"
 desc_option_vaapi="Enable support for VA-API"
 desc_option_pulseaudio="Enable support for PulseAudio"
 desc_option_sndio="Enable support for sndio"
+desc_option_pipewire="Enable support for screen sharing for WebRTC via PipeWire"
 
 hostmakedepends="$(vopt_if clang clang) python pkgconf perl gperf bison ninja nodejs hwids
  libatomic-devel libevent-devel libglib-devel $(vopt_if js_optimize openjdk)"
@@ -34,7 +35,7 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
  libjpeg-turbo-devel libevent-devel json-c-devel harfbuzz-devel
  minizip-devel jsoncpp-devel zlib-devel libcap-devel libXdamage-devel
  re2-devel fontconfig-devel freetype-devel opus-devel
- ffmpeg-devel libva-devel python-setuptools xcb-proto
+ ffmpeg-devel libva-devel python-setuptools xcb-proto libpipewire0.2-devel
  $(vopt_if sndio sndio-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
@@ -42,7 +43,7 @@ case "$XBPS_TARGET_MACHINE" in
 	ppc64*-musl) makedepends+=" libucontext-devel" ;;
 esac
 
-build_options_default="clang js_optimize vaapi pulseaudio"
+build_options_default="clang js_optimize vaapi pulseaudio pipewire"
 
 post_patch() {
 	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -196,6 +197,10 @@ do_configure() {
 		"use_pulseaudio=$(vopt_if pulseaudio true false)"
 	)
 
+	conf+=(
+		"rtc_use_pipewire=$(vopt_if pipewire true false)"
+	)
+
 	# Use explicit library dependencies instead of dlopen.
 	# GN only has "link_pulseaudio", the other options used before are not available atm
 	# linux_link_cups=true

  parent reply	other threads:[~2020-11-21  1:46 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
2020-11-05  4:25 ` [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire Logarithmus
2020-11-05  4:25 ` Logarithmus
2020-11-05  4:38 ` Logarithmus
2020-11-11  1:43 ` Logarithmus
2020-11-11  2:13 ` Logarithmus
2020-11-11  3:02 ` Logarithmus
2020-11-13 20:33 ` Logarithmus
2020-11-15  7:50 ` Logarithmus
2020-11-15 22:06 ` Logarithmus
2020-11-16  1:08 ` Logarithmus
2020-11-16  4:00 ` Logarithmus
2020-11-16  4:44 ` Logarithmus
2020-11-16 14:12 ` Logarithmus
2020-11-16 14:15 ` Logarithmus
2020-11-17 14:53 ` Logarithmus
2020-11-18  4:16 ` Logarithmus
2020-11-18  4:20 ` Logarithmus
2020-11-19  5:41 ` [PR PATCH] [Updated] " Logarithmus
2020-11-19 20:40 ` [PR PATCH] [Updated] [ci skip] chromium: update to 87.0.4280.66 & " Logarithmus
2020-11-19 21:54 ` Logarithmus
2020-11-20  1:02 ` [PR PATCH] [Updated] chromium: " Logarithmus
2020-11-20 21:26 ` Logarithmus
2020-11-21  0:59 ` [PR PATCH] [Updated] " Logarithmus
2020-11-21  1:00 ` Logarithmus
2020-11-21  1:03 ` ericonr
2020-11-21  1:15 ` [PR PATCH] [Updated] " Logarithmus
2020-11-21  1:35 ` Logarithmus
2020-11-21  1:46 ` Logarithmus [this message]
2020-11-21  1:53 ` Logarithmus
2020-11-21  1:54 ` Logarithmus
2020-11-21  1:54 ` Logarithmus
2020-11-21  1:57 ` Logarithmus
2020-11-21  1:57 ` Logarithmus
2020-11-21  1:57 ` Logarithmus
2020-11-21  1:59 ` Logarithmus
2020-11-21  2:00 ` ericonr
2020-11-21  2:08 ` Logarithmus
2020-11-21  2:08 ` Logarithmus
2020-11-21  2:08 ` Logarithmus
2020-11-21  2:10 ` Logarithmus
2020-11-21  2:28 ` [PR PATCH] [Updated] " Logarithmus
2020-11-21  2:29 ` Logarithmus
2020-11-21 11:17 ` ifreund
2020-11-21 11:44 ` Logarithmus
2020-11-21 11:44 ` Logarithmus
2020-11-21 12:33 ` ifreund
2020-11-21 12:34 ` ifreund
2020-11-21 13:21 ` Logarithmus
2020-11-21 13:22 ` Logarithmus
2020-11-21 13:23 ` Logarithmus
2020-11-21 19:04 ` ifreund
2020-11-22 14:52 ` ifreund
2020-12-03  7:10 ` [PR PATCH] [Updated] " Logarithmus
2020-12-13 21:42 ` Logarithmus
2020-12-13 21:42 ` [PR PATCH] [Closed]: " Logarithmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201121014654.8XwflfTjX1RK3e7IyK14nwCL6TUTWE7IvcrAL4Uo6U0@z \
    --to=logarithmus@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).