Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] chromium: enable
@ 2020-11-05  3:49 Logarithmus
  2020-11-05  4:25 ` [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire Logarithmus
                   ` (51 more replies)
  0 siblings, 52 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-05  3:49 UTC (permalink / raw)
  To: ml

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

There is a new 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
This package is required for screencasting in Chromium on Wayland.
We also 

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: 2334 bytes --]

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

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
@ 2020-11-05  4:25 ` Logarithmus
  2020-11-05  4:25 ` Logarithmus
                   ` (50 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-05  4:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 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
- [x] libpipewire0.2
- [ ] patch chromium's template
- [ ] test building for all archs:
    - [ ] x86_64
    - [ ] i686
    - [ ] aarch64
    - [ ] armv7l
    - [ ] x86_64-musl
    - [ ] armv6l-musl
    - [ ] aarch64-musl

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: 5006 bytes --]

From 40a348868b7f81d2b0e0599fd3955c32c0725306 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/2] New package: libpipewire0.2

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

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

---
 srcpkgs/chromium/template | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 980b0d72843..6035c7105c1 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -2,7 +2,7 @@
 pkgname=chromium
 # See http://www.chromium.org/developers/calendar for the latest version
 version=86.0.4240.111
-revision=1
+revision=2
 archs="i686* x86_64* aarch64* armv7l* ppc64le*"
 short_desc="Google's attempt at creating a safer, faster, and more stable browser"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -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)"
@@ -35,14 +36,15 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
- $(vopt_if sndio sndio-devel)"
+ $(vopt_if sndio sndio-devel)
+ $(vopt_if pipewire libpipewire0.2-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
 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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  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
                   ` (49 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-05  4:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 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
- [x] libpipewire0.2
- [ ] patch chromium's template
- [ ] test building for all archs:
    - [ ] x86_64
    - [ ] i686
    - [ ] aarch64
    - [ ] armv7l
    - [ ] x86_64-musl
    - [ ] armv6l-musl
    - [ ] aarch64-musl

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: 5017 bytes --]

From 40a348868b7f81d2b0e0599fd3955c32c0725306 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/2] New package: libpipewire0.2

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

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

---
 srcpkgs/chromium/template | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 980b0d72843..6035c7105c1 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -2,7 +2,7 @@
 pkgname=chromium
 # See http://www.chromium.org/developers/calendar for the latest version
 version=86.0.4240.111
-revision=1
+revision=2
 archs="i686* x86_64* aarch64* armv7l* ppc64le*"
 short_desc="Google's attempt at creating a safer, faster, and more stable browser"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -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)"
@@ -35,14 +36,15 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
- $(vopt_if sndio sndio-devel)"
+ $(vopt_if sndio sndio-devel)
+ $(vopt_if pipewire libpipewire0.2-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
 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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  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
                   ` (48 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-05  4:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 562 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
- [x] libpipewire0.2
- [x] patch chromium's template
- [ ] test building for all archs:
    - [ ] x86_64
    - [ ] i686
    - [ ] aarch64
    - [ ] armv7l
    - [ ] x86_64-musl
    - [ ] aarch64-musl

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: 5017 bytes --]

From 40a348868b7f81d2b0e0599fd3955c32c0725306 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/2] New package: libpipewire0.2

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

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

---
 srcpkgs/chromium/template | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 980b0d72843..6035c7105c1 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -2,7 +2,7 @@
 pkgname=chromium
 # See http://www.chromium.org/developers/calendar for the latest version
 version=86.0.4240.111
-revision=1
+revision=2
 archs="i686* x86_64* aarch64* armv7l* ppc64le*"
 short_desc="Google's attempt at creating a safer, faster, and more stable browser"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -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)"
@@ -35,14 +36,15 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
- $(vopt_if sndio sndio-devel)"
+ $(vopt_if sndio sndio-devel)
+ $(vopt_if pipewire libpipewire0.2-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
 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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (2 preceding siblings ...)
  2020-11-05  4:38 ` Logarithmus
@ 2020-11-11  1:43 ` Logarithmus
  2020-11-11  2:13 ` Logarithmus
                   ` (47 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-11  1:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 562 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
- [x] libpipewire0.2
- [x] patch chromium's template
- [ ] test building for all archs:
    - [ ] x86_64
    - [ ] i686
    - [ ] aarch64
    - [ ] armv7l
    - [ ] x86_64-musl
    - [ ] aarch64-musl

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: 4677 bytes --]

From 734d54367d7fba8394eb846d3381b5213f373bcd 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/2] New package: libpipewire0.2

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

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

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

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 0c259fabf3b..56afe448638 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)"
@@ -35,14 +36,15 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
- $(vopt_if sndio sndio-devel)"
+ $(vopt_if sndio sndio-devel)
+ $(vopt_if pipewire libpipewire0.2-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
 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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (3 preceding siblings ...)
  2020-11-11  1:43 ` Logarithmus
@ 2020-11-11  2:13 ` Logarithmus
  2020-11-11  3:02 ` Logarithmus
                   ` (46 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-11  2:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 562 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
- [x] libpipewire0.2
- [x] patch chromium's template
- [ ] test building for all archs:
    - [ ] x86_64
    - [ ] i686
    - [ ] aarch64
    - [ ] armv7l
    - [ ] x86_64-musl
    - [ ] aarch64-musl

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: 5017 bytes --]

From 40a348868b7f81d2b0e0599fd3955c32c0725306 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/2] New package: libpipewire0.2

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

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

---
 srcpkgs/chromium/template | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 980b0d72843..6035c7105c1 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -2,7 +2,7 @@
 pkgname=chromium
 # See http://www.chromium.org/developers/calendar for the latest version
 version=86.0.4240.111
-revision=1
+revision=2
 archs="i686* x86_64* aarch64* armv7l* ppc64le*"
 short_desc="Google's attempt at creating a safer, faster, and more stable browser"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -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)"
@@ -35,14 +36,15 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
- $(vopt_if sndio sndio-devel)"
+ $(vopt_if sndio sndio-devel)
+ $(vopt_if pipewire libpipewire0.2-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
 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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (4 preceding siblings ...)
  2020-11-11  2:13 ` Logarithmus
@ 2020-11-11  3:02 ` Logarithmus
  2020-11-13 20:33 ` Logarithmus
                   ` (45 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-11  3:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 562 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
- [x] libpipewire0.2
- [x] patch chromium's template
- [ ] test building for all archs:
    - [ ] x86_64
    - [ ] i686
    - [ ] aarch64
    - [ ] armv7l
    - [ ] x86_64-musl
    - [ ] aarch64-musl

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: 4677 bytes --]

From 1529dcc12b107d467ed5e49a281bb05463979769 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/2] New package: libpipewire0.2

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

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

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

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 0c259fabf3b..56afe448638 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)"
@@ -35,14 +36,15 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
- $(vopt_if sndio sndio-devel)"
+ $(vopt_if sndio sndio-devel)
+ $(vopt_if pipewire libpipewire0.2-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
 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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (5 preceding siblings ...)
  2020-11-11  3:02 ` Logarithmus
@ 2020-11-13 20:33 ` Logarithmus
  2020-11-15  7:50 ` Logarithmus
                   ` (44 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-13 20:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 562 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
- [x] libpipewire0.2
- [x] patch chromium's template
- [ ] test building for all archs:
    - [ ] x86_64
    - [ ] i686
    - [ ] aarch64
    - [ ] armv7l
    - [ ] x86_64-musl
    - [ ] aarch64-musl

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: 4684 bytes --]

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

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

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index e9db11e215c..b80316b772d 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)"
@@ -35,14 +36,15 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
- $(vopt_if sndio sndio-devel)"
+ $(vopt_if sndio sndio-devel)
+ $(vopt_if pipewire libpipewire0.2-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
 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 +198,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

From c257f91fe73ed24ab2bc8935be82219d3cf73b5d Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Fri, 13 Nov 2020 23:32:20 +0300
Subject: [PATCH 2/2] New package: libpipewire0.2-0.2.7

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (6 preceding siblings ...)
  2020-11-13 20:33 ` Logarithmus
@ 2020-11-15  7:50 ` Logarithmus
  2020-11-15 22:06 ` Logarithmus
                   ` (43 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-15  7:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 562 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
- [x] libpipewire0.2
- [x] patch chromium's template
- [ ] test building for all archs:
    - [ ] x86_64
    - [ ] i686
    - [ ] aarch64
    - [ ] armv7l
    - [ ] x86_64-musl
    - [ ] aarch64-musl

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: 4777 bytes --]

From 0c3d6ff5d4813af47b75bcf803c6cef67c550a1e Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Fri, 13 Nov 2020 23:32:20 +0300
Subject: [PATCH 1/2] New package: libpipewire0.2-0.2.7

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 37 +++++++++++++++++++++++++++++++++
 2 files changed, 38 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..3dc4cb34d02
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,37 @@
+# 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/pipewire
+		vmove usr/include/spa
+		vmove usr/lib/pkgconfig
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

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

---
 srcpkgs/chromium/template | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index e9db11e215c..263d4de96ce 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -2,7 +2,7 @@
 pkgname=chromium
 # See http://www.chromium.org/developers/calendar for the latest version
 version=86.0.4240.193
-revision=1
+revision=2
 archs="i686* x86_64* aarch64* armv7l* ppc64le*"
 short_desc="Google's attempt at creating a safer, faster, and more stable browser"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -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)"
@@ -35,14 +36,15 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
- $(vopt_if sndio sndio-devel)"
+ $(vopt_if sndio sndio-devel)
+ $(vopt_if pipewire libpipewire0.2-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
 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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (7 preceding siblings ...)
  2020-11-15  7:50 ` Logarithmus
@ 2020-11-15 22:06 ` Logarithmus
  2020-11-16  1:08 ` Logarithmus
                   ` (42 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-15 22:06 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1308 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
- [x] libpipewire0.2
- [x] patch chromium's template
- [ ] test building for all archs:
    - [ ] x86_64 - 🚧
    - [ ] i686 - 🚧
    - [x] aarch64 - ignoring because `nocross=yes`
    - [x] armv7l - ignoring because `nocross=yes`
    - [x] x86_64-musl - works with some issues (tested on my laptop: https://youtu.be/0JOtntP9_oU):
    * have to kill `xdg-desktop-portal*` processes sometimes, probably caused by some sort of race condition;
    * some services work, others don't:
        ✔️ https://www.webrtc-experiment.com/Pluginfree-Screen-Sharing
        ⚠️ https://zoom.us web version - you need to start/stop screen sharing multiple times before it will eventually work
        ❌ https://discord.com web version - screen sharing starts, but it shows nothing
        ❓ https://web.skype.com - not tested yet
        ❓ https://meet.google.com - not tested yet
    - [x] aarch64-musl - ignoring because `nocross=yes`

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: 7866 bytes --]

From b734006149b008e2078dff4541a3e27c119323ca 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/3] New package: libpipewire0.2

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

From 65feba778e4d3793b58e9b473c25978aa36088e2 Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Mon, 16 Nov 2020 00:59:09 +0300
Subject: [PATCH 2/3] pipewire: update to 0.3.15 & patch for chromium compat

---
 ...x-pipewire-0.2-clients-like-chromium.patch | 44 +++++++++++++++++++
 srcpkgs/pipewire/template                     |  4 +-
 2 files changed, 46 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/pipewire/patches/fix-pipewire-0.2-clients-like-chromium.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/template b/srcpkgs/pipewire/template
index 930e4b6a0af..d377343f286 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
@@ -15,7 +15,7 @@ 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 59ff867b3dd008f700298f35feb26b3df11361b8 Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Thu, 5 Nov 2020 07:24:27 +0300
Subject: [PATCH 3/3] chromium: enable WebRTC screen sharing via PipeWire [ci
 skip]

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

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index e9db11e215c..b80316b772d 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)"
@@ -35,14 +36,15 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
- $(vopt_if sndio sndio-devel)"
+ $(vopt_if sndio sndio-devel)
+ $(vopt_if pipewire libpipewire0.2-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
 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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (8 preceding siblings ...)
  2020-11-15 22:06 ` Logarithmus
@ 2020-11-16  1:08 ` Logarithmus
  2020-11-16  4:00 ` Logarithmus
                   ` (41 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-16  1:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1308 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
- [x] libpipewire0.2
- [x] patch chromium's template
- [ ] test building for all archs:
    - [ ] x86_64 - 🚧
    - [ ] i686 - 🚧
    - [x] aarch64 - ignoring because `nocross=yes`
    - [x] armv7l - ignoring because `nocross=yes`
    - [x] x86_64-musl - works with some issues (tested on my laptop: https://youtu.be/0JOtntP9_oU):
    * have to kill `xdg-desktop-portal*` processes sometimes, probably caused by some sort of race condition;
    * some services work, others don't:
        ✔️ https://www.webrtc-experiment.com/Pluginfree-Screen-Sharing
        ⚠️ https://zoom.us web version - you need to start/stop screen sharing multiple times before it will eventually work
        ❌ https://discord.com web version - screen sharing starts, but it shows nothing
        ❓ https://web.skype.com - not tested yet
        ❓ https://meet.google.com - not tested yet
    - [x] aarch64-musl - ignoring because `nocross=yes`

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: 9333 bytes --]

From b734006149b008e2078dff4541a3e27c119323ca 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/3] New package: libpipewire0.2

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

From 948c3e349d51d523c2f82cabae9835fddd01f56c Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Mon, 16 Nov 2020 00:59:09 +0300
Subject: [PATCH 2/3] 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                     |  4 +-
 3 files changed, 77 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..d377343f286 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
@@ -15,7 +15,7 @@ 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 838c771b72a0e227a31cbec764e9a2e60b8c670d Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Thu, 5 Nov 2020 07:24:27 +0300
Subject: [PATCH 3/3] chromium: enable WebRTC screen sharing via PipeWire [ci
 skip]

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

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index e9db11e215c..b80316b772d 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)"
@@ -35,14 +36,15 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
- $(vopt_if sndio sndio-devel)"
+ $(vopt_if sndio sndio-devel)
+ $(vopt_if pipewire libpipewire0.2-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
 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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (9 preceding siblings ...)
  2020-11-16  1:08 ` Logarithmus
@ 2020-11-16  4:00 ` Logarithmus
  2020-11-16  4:44 ` Logarithmus
                   ` (40 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-16  4:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1308 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
- [x] libpipewire0.2
- [x] patch chromium's template
- [ ] test building for all archs:
    - [ ] x86_64 - 🚧
    - [ ] i686 - 🚧
    - [x] aarch64 - ignoring because `nocross=yes`
    - [x] armv7l - ignoring because `nocross=yes`
    - [x] x86_64-musl - works with some issues (tested on my laptop: https://youtu.be/0JOtntP9_oU):
    * have to kill `xdg-desktop-portal*` processes sometimes, probably caused by some sort of race condition;
    * some services work, others don't:
        ✔️ https://www.webrtc-experiment.com/Pluginfree-Screen-Sharing
        ⚠️ https://zoom.us web version - you need to start/stop screen sharing multiple times before it will eventually work
        ❌ https://discord.com web version - screen sharing starts, but it shows nothing
        ❓ https://web.skype.com - not tested yet
        ❓ https://meet.google.com - not tested yet
    - [x] aarch64-musl - ignoring because `nocross=yes`

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: 11039 bytes --]

From b734006149b008e2078dff4541a3e27c119323ca 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 | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

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

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

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index e9db11e215c..b80316b772d 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)"
@@ -35,14 +36,15 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
- $(vopt_if sndio sndio-devel)"
+ $(vopt_if sndio sndio-devel)
+ $(vopt_if pipewire libpipewire0.2-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
 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 +198,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

From 8db23a364d410d120c7777f7cb2e51bd39067f85 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 534d54f662b78d65c7889f2543191276a411bd5c Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Mon, 16 Nov 2020 07:00:34 +0300
Subject: [PATCH 4/4] linux: disable CONFIG_RT_GROUP_SCHED for pulseaudio and
 pipewire

---
 srcpkgs/linux5.9/files/x86_64-dotconfig | 2 +-
 srcpkgs/linux5.9/template               | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/linux5.9/files/x86_64-dotconfig b/srcpkgs/linux5.9/files/x86_64-dotconfig
index d853eda50b1..e6bf60737ca 100644
--- a/srcpkgs/linux5.9/files/x86_64-dotconfig
+++ b/srcpkgs/linux5.9/files/x86_64-dotconfig
@@ -166,7 +166,7 @@ CONFIG_CGROUP_WRITEBACK=y
 CONFIG_CGROUP_SCHED=y
 CONFIG_FAIR_GROUP_SCHED=y
 CONFIG_CFS_BANDWIDTH=y
-CONFIG_RT_GROUP_SCHED=y
+# CONFIG_RT_GROUP_SCHED is not set
 CONFIG_CGROUP_PIDS=y
 # CONFIG_CGROUP_RDMA is not set
 CONFIG_CGROUP_FREEZER=y
diff --git a/srcpkgs/linux5.9/template b/srcpkgs/linux5.9/template
index 378f60e6326..efc8e024af2 100644
--- a/srcpkgs/linux5.9/template
+++ b/srcpkgs/linux5.9/template
@@ -1,7 +1,7 @@
 # Template file for 'linux5.9'
 pkgname=linux5.9
 version=5.9.8
-revision=1
+revision=2
 wrksrc="linux-${version}"
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Érico Nogueira <ericonr@disroot.org>"

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (10 preceding siblings ...)
  2020-11-16  4:00 ` Logarithmus
@ 2020-11-16  4:44 ` Logarithmus
  2020-11-16 14:12 ` Logarithmus
                   ` (39 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-16  4:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1308 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
- [x] libpipewire0.2
- [x] patch chromium's template
- [ ] test building for all archs:
    - [ ] x86_64 - 🚧
    - [ ] i686 - 🚧
    - [x] aarch64 - ignoring because `nocross=yes`
    - [x] armv7l - ignoring because `nocross=yes`
    - [x] x86_64-musl - works with some issues (tested on my laptop: https://youtu.be/0JOtntP9_oU):
    * have to kill `xdg-desktop-portal*` processes sometimes, probably caused by some sort of race condition;
    * some services work, others don't:
        ✔️ https://www.webrtc-experiment.com/Pluginfree-Screen-Sharing
        ⚠️ https://zoom.us web version - you need to start/stop screen sharing multiple times before it will eventually work
        ❌ https://discord.com web version - screen sharing starts, but it shows nothing
        ❓ https://web.skype.com - not tested yet
        ❓ https://meet.google.com - not tested yet
    - [x] aarch64-musl - ignoring because `nocross=yes`

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: 11039 bytes --]

From c77541f3f5f8ac3f58c9c5c0d880041977350b95 Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Mon, 16 Nov 2020 07:00:34 +0300
Subject: [PATCH 1/4] linux: disable CONFIG_RT_GROUP_SCHED for pulseaudio and
 pipewire

---
 srcpkgs/linux5.9/files/x86_64-dotconfig | 2 +-
 srcpkgs/linux5.9/template               | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/linux5.9/files/x86_64-dotconfig b/srcpkgs/linux5.9/files/x86_64-dotconfig
index d853eda50b1..e6bf60737ca 100644
--- a/srcpkgs/linux5.9/files/x86_64-dotconfig
+++ b/srcpkgs/linux5.9/files/x86_64-dotconfig
@@ -166,7 +166,7 @@ CONFIG_CGROUP_WRITEBACK=y
 CONFIG_CGROUP_SCHED=y
 CONFIG_FAIR_GROUP_SCHED=y
 CONFIG_CFS_BANDWIDTH=y
-CONFIG_RT_GROUP_SCHED=y
+# CONFIG_RT_GROUP_SCHED is not set
 CONFIG_CGROUP_PIDS=y
 # CONFIG_CGROUP_RDMA is not set
 CONFIG_CGROUP_FREEZER=y
diff --git a/srcpkgs/linux5.9/template b/srcpkgs/linux5.9/template
index 378f60e6326..efc8e024af2 100644
--- a/srcpkgs/linux5.9/template
+++ b/srcpkgs/linux5.9/template
@@ -1,7 +1,7 @@
 # Template file for 'linux5.9'
 pkgname=linux5.9
 version=5.9.8
-revision=1
+revision=2
 wrksrc="linux-${version}"
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Érico Nogueira <ericonr@disroot.org>"

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

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

From 2ee6064ccb66f8f5873b0ecc2775b7b8a187b3cc 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 20ece8a6dc090046ee3726d831329ae523b0ba7d 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 | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index e9db11e215c..b80316b772d 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)"
@@ -35,14 +36,15 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
- $(vopt_if sndio sndio-devel)"
+ $(vopt_if sndio sndio-devel)
+ $(vopt_if pipewire libpipewire0.2-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
 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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (11 preceding siblings ...)
  2020-11-16  4:44 ` Logarithmus
@ 2020-11-16 14:12 ` Logarithmus
  2020-11-16 14:15 ` Logarithmus
                   ` (38 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-16 14:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2564 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
- [x] libpipewire0.2
- [x] patch chromium's template
- [ ] test building for all archs:
    - [ ] x86_64 - 🚧
    - [ ] i686 - 🚧
    - [x] aarch64 - ignoring because `nocross=yes`
    - [x] armv7l - ignoring because `nocross=yes`
    - [x] x86_64-musl - works with some issues (tested on my laptop: https://youtu.be/HnD5mgPn8gk):
    * 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)
        ❓ https://web.skype.com - not tested yet
        ❓ https://meet.google.com - not tested yet
    - [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

So now I'm building `linux5.9` for `x86_64` with `CONFIG_RT_GROUP_SCHED` disabled.
I hope it will help, but honestly chances are fairly low.

Right now I have `chromium` for `x86_64` & `i386` and `linux5.9` builds running inside my Void Linux DigitalOcean droplet.
They will take a few hours to finish I think.

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: 11379 bytes --]

From c77541f3f5f8ac3f58c9c5c0d880041977350b95 Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Mon, 16 Nov 2020 07:00:34 +0300
Subject: [PATCH 1/4] linux: disable CONFIG_RT_GROUP_SCHED for pulseaudio and
 pipewire

---
 srcpkgs/linux5.9/files/x86_64-dotconfig | 2 +-
 srcpkgs/linux5.9/template               | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/linux5.9/files/x86_64-dotconfig b/srcpkgs/linux5.9/files/x86_64-dotconfig
index d853eda50b1..e6bf60737ca 100644
--- a/srcpkgs/linux5.9/files/x86_64-dotconfig
+++ b/srcpkgs/linux5.9/files/x86_64-dotconfig
@@ -166,7 +166,7 @@ CONFIG_CGROUP_WRITEBACK=y
 CONFIG_CGROUP_SCHED=y
 CONFIG_FAIR_GROUP_SCHED=y
 CONFIG_CFS_BANDWIDTH=y
-CONFIG_RT_GROUP_SCHED=y
+# CONFIG_RT_GROUP_SCHED is not set
 CONFIG_CGROUP_PIDS=y
 # CONFIG_CGROUP_RDMA is not set
 CONFIG_CGROUP_FREEZER=y
diff --git a/srcpkgs/linux5.9/template b/srcpkgs/linux5.9/template
index 378f60e6326..efc8e024af2 100644
--- a/srcpkgs/linux5.9/template
+++ b/srcpkgs/linux5.9/template
@@ -1,7 +1,7 @@
 # Template file for 'linux5.9'
 pkgname=linux5.9
 version=5.9.8
-revision=1
+revision=2
 wrksrc="linux-${version}"
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Érico Nogueira <ericonr@disroot.org>"

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

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

From 2ee6064ccb66f8f5873b0ecc2775b7b8a187b3cc 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 ad979efae04aa62d20f935594f68e81e3238fae7 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 | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index e9db11e215c..263d4de96ce 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -2,7 +2,7 @@
 pkgname=chromium
 # See http://www.chromium.org/developers/calendar for the latest version
 version=86.0.4240.193
-revision=1
+revision=2
 archs="i686* x86_64* aarch64* armv7l* ppc64le*"
 short_desc="Google's attempt at creating a safer, faster, and more stable browser"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -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)"
@@ -35,14 +36,15 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
- $(vopt_if sndio sndio-devel)"
+ $(vopt_if sndio sndio-devel)
+ $(vopt_if pipewire libpipewire0.2-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
 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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (12 preceding siblings ...)
  2020-11-16 14:12 ` Logarithmus
@ 2020-11-16 14:15 ` Logarithmus
  2020-11-17 14:53 ` Logarithmus
                   ` (37 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-16 14:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2564 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
- [x] libpipewire0.2
- [x] patch chromium's template
- [ ] test building for all archs:
    - [ ] x86_64 - 🚧
    - [ ] i686 - 🚧
    - [x] aarch64 - ignoring because `nocross=yes`
    - [x] armv7l - ignoring because `nocross=yes`
    - [x] x86_64-musl - works with some issues (tested on my laptop: https://youtu.be/HnD5mgPn8gk):
    * 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)
        ❓ https://web.skype.com - not tested yet
        ❓ https://meet.google.com - not tested yet
    - [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

So now I'm building `linux5.9` for `x86_64` with `CONFIG_RT_GROUP_SCHED` disabled.
I hope it will help, but honestly chances are fairly low.

Right now I have `chromium` for `x86_64` & `i386` and `linux5.9` builds running inside my Void Linux DigitalOcean droplet.
They will take a few hours to finish I think.

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: 34425 bytes --]

From 0e2604f5bd7e1d3505ca452374bc0ca656d5ae0a Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Mon, 16 Nov 2020 07:00:34 +0300
Subject: [PATCH 1/5] linux: disable CONFIG_RT_GROUP_SCHED for pulseaudio and
 pipewire

---
 srcpkgs/linux5.9/files/x86_64-dotconfig | 2 +-
 srcpkgs/linux5.9/template               | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/linux5.9/files/x86_64-dotconfig b/srcpkgs/linux5.9/files/x86_64-dotconfig
index d853eda50b1..e6bf60737ca 100644
--- a/srcpkgs/linux5.9/files/x86_64-dotconfig
+++ b/srcpkgs/linux5.9/files/x86_64-dotconfig
@@ -166,7 +166,7 @@ CONFIG_CGROUP_WRITEBACK=y
 CONFIG_CGROUP_SCHED=y
 CONFIG_FAIR_GROUP_SCHED=y
 CONFIG_CFS_BANDWIDTH=y
-CONFIG_RT_GROUP_SCHED=y
+# CONFIG_RT_GROUP_SCHED is not set
 CONFIG_CGROUP_PIDS=y
 # CONFIG_CGROUP_RDMA is not set
 CONFIG_CGROUP_FREEZER=y
diff --git a/srcpkgs/linux5.9/template b/srcpkgs/linux5.9/template
index 378f60e6326..efc8e024af2 100644
--- a/srcpkgs/linux5.9/template
+++ b/srcpkgs/linux5.9/template
@@ -1,7 +1,7 @@
 # Template file for 'linux5.9'
 pkgname=linux5.9
 version=5.9.8
-revision=1
+revision=2
 wrksrc="linux-${version}"
 short_desc="Linux kernel and modules (${version%.*} series)"
 maintainer="Érico Nogueira <ericonr@disroot.org>"

From c1155834af5a30fb8ceb570428abffb13e1959c5 Mon Sep 17 00:00:00 2001
From: "Issam E. Maghni" <issam.e.maghni@mailbox.org>
Date: Tue, 22 Sep 2020 18:36:38 -0400
Subject: [PATCH 2/5] xdg-desktop-portal: update to 1.8.0

---
 .../patches/pipewire-0.3.patch                | 551 ------------------
 srcpkgs/xdg-desktop-portal/template           |  23 +-
 2 files changed, 14 insertions(+), 560 deletions(-)
 delete mode 100644 srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch

diff --git a/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch b/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch
deleted file mode 100644
index 94ebe083598..00000000000
--- a/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch
+++ /dev/null
@@ -1,551 +0,0 @@
-From a38901e5e7f835efe7b7a06c55790c8c20bc91a2 Mon Sep 17 00:00:00 2001
-From: Wim Taymans <wtaymans@redhat.com>
-Date: Tue, 14 Jan 2020 09:37:09 +0100
-Subject: [PATCH] PipeWire: update to 0.3 API
-
----
- configure.ac      |   2 +-
- src/camera.c      |  24 ++++----
- src/pipewire.c    | 141 +++++++++++++---------------------------------
- src/pipewire.h    |  10 ++--
- src/screen-cast.c |  98 ++++++--------------------------
- 5 files changed, 72 insertions(+), 203 deletions(-)
-
-diff --git configure.ac configure.ac
-index 89902fa..62d7960 100644
---- configure.ac
-+++ configure.ac
-@@ -97,7 +97,7 @@ AC_ARG_ENABLE(pipewire,
- 	      [AS_HELP_STRING([--enable-pipewire],[Enable PipeWire support. Needed for screen cast portal])],
- 	      enable_pipewire=$enableval, enable_pipewire=yes)
- if test x$enable_pipewire = xyes ; then
--	PKG_CHECK_MODULES(PIPEWIRE, [libpipewire-0.2 >= 0.2.6])
-+	PKG_CHECK_MODULES(PIPEWIRE, [libpipewire-0.3 >= 0.2.90])
- 	AC_DEFINE([HAVE_PIPEWIRE],[1], [Define to enable PipeWire support])
- fi
- AM_CONDITIONAL([HAVE_PIPEWIRE],[test "$enable_pipewire" = "yes"])
-diff --git src/camera.c src/camera.c
-index c2b392c..20fe3aa 100644
---- src/camera.c
-+++ src/camera.c
-@@ -141,7 +141,7 @@ open_pipewire_camera_remote (const char *app_id,
-                              GError **error)
- {
-   PipeWireRemote *remote;
--  struct spa_dict_item permission_items[1];
-+  struct pw_permission permission_items[2];
-   struct pw_properties *pipewire_properties;
- 
-   pipewire_properties =
-@@ -158,12 +158,12 @@ open_pipewire_camera_remote (const char *app_id,
-    * Hide all existing and future nodes by default. PipeWire will use the
-    * permission store to set up permissions.
-    */
--  permission_items[0].key = PW_CORE_PROXY_PERMISSIONS_DEFAULT;
--  permission_items[0].value = "---";
-+  permission_items[0] = PW_PERMISSION_INIT (PW_ID_CORE, PW_PERM_RWX);
-+  permission_items[1] = PW_PERMISSION_INIT (PW_ID_ANY, 0);
- 
--  pw_core_proxy_permissions (pw_remote_get_core_proxy (remote->remote),
--                             &SPA_DICT_INIT (permission_items,
--                                             G_N_ELEMENTS (permission_items)));
-+  pw_client_update_permissions (pw_core_get_client(remote->core),
-+                                G_N_ELEMENTS (permission_items),
-+                                permission_items);
- 
-   pipewire_remote_roundtrip (remote);
- 
-@@ -219,7 +219,7 @@ handle_open_pipewire_remote (XdpCamera *object,
-     }
- 
-   out_fd_list = g_unix_fd_list_new ();
--  fd = pw_remote_steal_fd (remote->remote);
-+  fd = pw_core_steal_fd (remote->core);
-   fd_id = g_unix_fd_list_append (out_fd_list, fd, &error);
-   close (fd);
-   pipewire_remote_destroy (remote);
-@@ -250,29 +250,28 @@ camera_iface_init (XdpCameraIface *iface)
- static void
- global_added_cb (PipeWireRemote *remote,
-                  uint32_t id,
--                 uint32_t type,
-+                 const char *type,
-                  const struct spa_dict *props,
-                  gpointer user_data)
- {
-   Camera *camera = user_data;
--  struct pw_type *core_type = pw_core_get_type (remote->core);
-   const struct spa_dict_item *media_class;
-   const struct spa_dict_item *media_role;
- 
--  if (type != core_type->node)
-+  if (strcmp(type, PW_TYPE_INTERFACE_Node) != 0)
-     return;
- 
-   if (!props)
-     return;
- 
--  media_class = spa_dict_lookup_item (props, "media.class");
-+  media_class = spa_dict_lookup_item (props, PW_KEY_MEDIA_CLASS);
-   if (!media_class)
-     return;
- 
-   if (g_strcmp0 (media_class->value, "Video/Source") != 0)
-     return;
- 
--  media_role = spa_dict_lookup_item (props, "media.role");
-+  media_role = spa_dict_lookup_item (props, PW_KEY_MEDIA_ROLE);
-   if (!media_role)
-     return;
- 
-@@ -342,6 +341,7 @@ create_pipewire_remote (Camera *camera,
-     }
- 
-   pipewire_properties = pw_properties_new ("pipewire.access.portal.is_portal", "true",
-+                                           "portal.monitor", "Camera",
-                                            NULL);
-   camera->pipewire_remote = pipewire_remote_new_sync (pipewire_properties,
-                                                       global_added_cb,
-diff --git src/pipewire.c src/pipewire.c
-index 793a378..162cd55 100644
---- src/pipewire.c
-+++ src/pipewire.c
-@@ -21,6 +21,7 @@
- #include <errno.h>
- #include <glib.h>
- #include <pipewire/pipewire.h>
-+#include <spa/utils/result.h>
- 
- #include "pipewire.h"
- 
-@@ -36,27 +37,25 @@ static gboolean is_pipewire_initialized = FALSE;
- static void
- registry_event_global (void *user_data,
-                        uint32_t id,
--                       uint32_t parent_id,
-                        uint32_t permissions,
--                       uint32_t type,
-+                       const char *type,
-                        uint32_t version,
-                        const struct spa_dict *props)
- {
-   PipeWireRemote *remote = user_data;
--  struct pw_type *core_type = pw_core_get_type (remote->core);
-   const struct spa_dict_item *factory_object_type;
-   PipeWireGlobal *global;
- 
-   global = g_new0 (PipeWireGlobal, 1);
-   *global = (PipeWireGlobal) {
--    .parent_id = parent_id,
-+    .parent_id = id,
-   };
- 
-   g_hash_table_insert (remote->globals, GINT_TO_POINTER (id), global);
-   if (remote->global_added_cb)
-     remote->global_added_cb (remote, id, type, props, remote->user_data);
- 
--  if (type != core_type->factory)
-+  if (strcmp(type, PW_TYPE_INTERFACE_Factory) != 0)
-     return;
- 
-   factory_object_type = spa_dict_lookup_item (props, "factory.type.name");
-@@ -81,8 +80,8 @@ registry_event_global_remove (void *user_data,
-   g_hash_table_remove (remote->globals, GINT_TO_POINTER (id));
- }
- 
--static const struct pw_registry_proxy_events registry_events = {
--  PW_VERSION_REGISTRY_PROXY_EVENTS,
-+static const struct pw_registry_events registry_events = {
-+  PW_VERSION_REGISTRY_EVENTS,
-   .global = registry_event_global,
-   .global_remove = registry_event_global_remove,
- };
-@@ -90,7 +89,7 @@ static const struct pw_registry_proxy_events registry_events = {
- void
- pipewire_remote_roundtrip (PipeWireRemote *remote)
- {
--  pw_core_proxy_sync (remote->core_proxy, ++remote->sync_seq);
-+  remote->sync_seq = pw_core_sync (remote->core, PW_ID_CORE, remote->sync_seq);
-   pw_main_loop_run (remote->loop);
- }
- 
-@@ -98,16 +97,13 @@ static gboolean
- discover_node_factory_sync (PipeWireRemote *remote,
-                             GError **error)
- {
--  struct pw_type *core_type = pw_core_get_type (remote->core);
--  struct pw_registry_proxy *registry_proxy;
-+  struct pw_registry *registry;
- 
--  registry_proxy = pw_core_proxy_get_registry (remote->core_proxy,
--                                               core_type->registry,
--                                               PW_VERSION_REGISTRY, 0);
--  pw_registry_proxy_add_listener (registry_proxy,
--                                  &remote->registry_listener,
--                                  &registry_events,
--                                  remote);
-+  registry = pw_core_get_registry (remote->core, PW_VERSION_REGISTRY, 0);
-+  pw_registry_add_listener (registry,
-+                            &remote->registry_listener,
-+                            &registry_events,
-+                            remote);
- 
-   pipewire_remote_roundtrip (remote);
- 
-@@ -122,59 +118,35 @@ discover_node_factory_sync (PipeWireRemote *remote,
- }
- 
- static void
--on_state_changed (void *user_data,
--                  enum pw_remote_state old,
--                  enum pw_remote_state state,
--                  const char *error)
-+core_event_error (void       *user_data,
-+                  uint32_t    id,
-+		  int         seq,
-+		  int         res,
-+		  const char *message)
- {
-   PipeWireRemote *remote = user_data;
- 
--  switch (state)
-+  if (id == PW_ID_CORE)
-     {
--    case PW_REMOTE_STATE_ERROR:
--      if (!remote->error)
--        {
--          g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                       "%s", error);
--        }
-+      g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED,
-+                 "%s", message);
-       pw_main_loop_quit (remote->loop);
--      break;
--    case PW_REMOTE_STATE_UNCONNECTED:
--      if (!remote->error)
--        {
--          g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                       "Disconnected");
--        }
--      pw_main_loop_quit (remote->loop);
--      break;
--    case PW_REMOTE_STATE_CONNECTING:
--      break;
--    case PW_REMOTE_STATE_CONNECTED:
--      pw_main_loop_quit (remote->loop);
--      break;
--    default:
--      g_warning ("Unknown PipeWire state");
--      break;
-     }
- }
- 
--static const struct pw_remote_events remote_events = {
--  PW_VERSION_REMOTE_EVENTS,
--  .state_changed = on_state_changed,
--};
--
- static void
- core_event_done (void *user_data,
--                 uint32_t seq)
-+                 uint32_t id, int seq)
- {
-   PipeWireRemote *remote = user_data;
- 
--  if (remote->sync_seq == seq)
-+  if (id == PW_ID_CORE && remote->sync_seq == seq)
-     pw_main_loop_quit (remote->loop);
- }
- 
--static const struct pw_core_proxy_events core_events = {
--  PW_VERSION_CORE_PROXY_EVENTS,
-+static const struct pw_core_events core_events = {
-+  PW_VERSION_CORE_EVENTS,
-+  .error = core_event_error,
-   .done = core_event_done,
- };
- 
-@@ -237,8 +209,8 @@ void
- pipewire_remote_destroy (PipeWireRemote *remote)
- {
-   g_clear_pointer (&remote->globals, g_hash_table_destroy);
--  g_clear_pointer (&remote->remote, pw_remote_destroy);
--  g_clear_pointer (&remote->core, pw_core_destroy);
-+  g_clear_pointer (&remote->core, pw_core_disconnect);
-+  g_clear_pointer (&remote->context, pw_context_destroy);
-   g_clear_pointer (&remote->loop, pw_main_loop_destroy);
-   g_clear_error (&remote->error);
- 
-@@ -307,68 +279,31 @@ pipewire_remote_new_sync (struct pw_properties *pipewire_properties,
-       return NULL;
-     }
- 
--  remote->core = pw_core_new (pw_main_loop_get_loop (remote->loop), NULL);
--  if (!remote->core)
-+  remote->context = pw_context_new (pw_main_loop_get_loop (remote->loop), NULL, 0);
-+  if (!remote->context)
-     {
-       pipewire_remote_destroy (remote);
-       pw_properties_free (pipewire_properties);
-       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Couldn't create PipeWire core");
-+                   "Couldn't create PipeWire context");
-       return NULL;
-     }
- 
--  remote->remote = pw_remote_new (remote->core, pipewire_properties, 0);
--  if (!remote->remote)
-+  remote->core = pw_context_connect (remote->context, pipewire_properties, 0);
-+  if (!remote->core)
-     {
-       pipewire_remote_destroy (remote);
-       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Couldn't create PipeWire remote");
-+                   "Couldn't connect to PipeWire");
-       return NULL;
-     }
- 
-   remote->globals = g_hash_table_new_full (NULL, NULL, NULL, g_free);
- 
--  pw_remote_add_listener (remote->remote,
--                          &remote->remote_listener,
--                          &remote_events,
--                          remote);
--
--  if (pw_remote_connect (remote->remote) != 0)
--    {
--      pipewire_remote_destroy (remote);
--      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Couldn't connect PipeWire remote");
--      return NULL;
--    }
--
--  pw_main_loop_run (remote->loop);
--
--  switch (pw_remote_get_state (remote->remote, NULL))
--    {
--    case PW_REMOTE_STATE_ERROR:
--    case PW_REMOTE_STATE_UNCONNECTED:
--      *error = g_steal_pointer (&remote->error);
--      pipewire_remote_destroy (remote);
--      return NULL;
--    case PW_REMOTE_STATE_CONNECTING:
--      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "PipeWire loop stopped unexpectedly");
--      pipewire_remote_destroy (remote);
--      return NULL;
--    case PW_REMOTE_STATE_CONNECTED:
--      break;
--    default:
--      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Unexpected PipeWire state");
--      pipewire_remote_destroy (remote);
--      return NULL;
--    }
--
--  remote->core_proxy = pw_remote_get_core_proxy (remote->remote);
--  pw_core_proxy_add_listener (remote->core_proxy,
--                              &remote->core_listener,
--                              &core_events,
--                              remote);
-+  pw_core_add_listener (remote->core,
-+                        &remote->core_listener,
-+                        &core_events,
-+                        remote);
- 
-   if (!discover_node_factory_sync (remote, error))
-     {
-diff --git src/pipewire.h src/pipewire.h
-index 0f1bf54..bf48d5e 100644
---- src/pipewire.h
-+++ src/pipewire.h
-@@ -32,7 +32,7 @@ typedef struct _PipeWireGlobal
- 
- typedef void (* PipeWireGlobalAddedCallback) (PipeWireRemote *remote,
-                                               uint32_t id,
--                                              uint32_t type,
-+                                              const char *type,
-                                               const struct spa_dict *props,
-                                               gpointer user_data);
- 
-@@ -43,13 +43,11 @@ typedef void (* PipeWireGlobalRemovedCallback) (PipeWireRemote *remote,
- struct _PipeWireRemote
- {
-   struct pw_main_loop *loop;
-+  struct pw_context *context;
-   struct pw_core *core;
--  struct pw_remote *remote;
--  struct spa_hook remote_listener;
--
--  struct pw_core_proxy *core_proxy;
-   struct spa_hook core_listener;
--  uint32_t sync_seq;
-+
-+  int sync_seq;
- 
-   struct spa_hook registry_listener;
- 
-diff --git src/screen-cast.c src/screen-cast.c
-index 7881ddc..1677050 100644
---- src/screen-cast.c
-+++ src/screen-cast.c
-@@ -31,10 +31,10 @@
- #include "xdp-impl-dbus.h"
- #include "xdp-utils.h"
- 
--#define PERMISSION_ITEM(item_key, item_value) \
--  ((struct spa_dict_item) { \
--    .key = item_key, \
--    .value = item_value \
-+#define PERMISSION_ITEM(item_id, item_permissions) \
-+  ((struct pw_permission) { \
-+    .id = item_id, \
-+    .permissions = item_permissions \
-   })
- 
- typedef struct _ScreenCast ScreenCast;
-@@ -517,42 +517,9 @@ screen_cast_stream_get_pipewire_node_id (ScreenCastStream *stream)
-   return stream->id;
- }
- 
--static void
--append_parent_permissions (PipeWireRemote *remote,
--                           GArray *permission_items,
--                           GList **string_stash,
--                           PipeWireGlobal *global,
--                           const char *permission)
--{
--  PipeWireGlobal *parent;
--  char *parent_permission_value;
--
--  if (global->parent_id == 0)
--    return;
--
--  parent = g_hash_table_lookup (remote->globals, GINT_TO_POINTER (global->parent_id));
--
--  if (parent->permission_set)
--    return;
--  parent->permission_set = TRUE;
--
--  append_parent_permissions (remote, permission_items, string_stash,
--                             parent, permission);
--
--  parent_permission_value = g_strdup_printf ("%u:%s",
--                                             global->parent_id,
--                                             permission);
--  *string_stash = g_list_prepend (*string_stash, parent_permission_value);
--
--  g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                       parent_permission_value));
--}
--
- static void
- append_stream_permissions (PipeWireRemote *remote,
-                            GArray *permission_items,
--                           GList **string_stash,
-                            GList *streams)
- {
-   GList *l;
-@@ -561,21 +528,10 @@ append_stream_permissions (PipeWireRemote *remote,
-     {
-       ScreenCastStream *stream = l->data;
-       uint32_t stream_id;
--      PipeWireGlobal *stream_global;
--      char *stream_permission_value;
- 
-       stream_id = screen_cast_stream_get_pipewire_node_id (stream);
--      stream_global = g_hash_table_lookup (remote->globals,
--                                           GINT_TO_POINTER (stream_id));
--
--      append_parent_permissions (remote, permission_items, string_stash,
--                                 stream_global, "r--");
--
--      stream_permission_value = g_strdup_printf ("%u:rwx", stream_id);
--      *string_stash = g_list_prepend (*string_stash, stream_permission_value);
-       g_array_append_val (permission_items,
--                          PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                           stream_permission_value));
-+                          PERMISSION_ITEM (stream_id, PW_PERM_RWX));
-     }
- }
- 
-@@ -587,9 +543,6 @@ open_pipewire_screen_cast_remote (const char *app_id,
-   struct pw_properties *pipewire_properties;
-   PipeWireRemote *remote;
-   g_autoptr(GArray) permission_items = NULL;
--  char *node_factory_permission_string;
--  GList *string_stash = NULL;
--  struct spa_dict *permission_dict;
-   PipeWireGlobal *node_global;
- 
-   pipewire_properties = pw_properties_new ("pipewire.access.portal.app_id", app_id,
-@@ -603,48 +556,31 @@ open_pipewire_screen_cast_remote (const char *app_id,
- 
-   permission_items = g_array_new (FALSE, TRUE, sizeof (struct spa_dict_item));
- 
--  /*
--   * Hide all existing and future nodes (except the ones we explicitly list below.
--   */
--  g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_EXISTING,
--                                       "---"));
--  g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_DEFAULT,
--                                       "---"));
--
-   /*
-    * PipeWire:Interface:Core
-    * Needs rwx to be able create the sink node using the create-object method
-    */
-   g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                       "0:rwx"));
-+                      PERMISSION_ITEM (PW_ID_CORE, PW_PERM_RWX));
- 
-   /*
-    * PipeWire:Interface:NodeFactory
-    * Needs r-- so it can be passed to create-object when creating the sink node.
-    */
--  node_factory_permission_string = g_strdup_printf ("%d:r--",
--                                                    remote->node_factory_id);
--  string_stash = g_list_prepend (string_stash, node_factory_permission_string);
-   g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                       node_factory_permission_string));
--  node_global = g_hash_table_lookup (remote->globals,
--                                     GINT_TO_POINTER (remote->node_factory_id));
--  append_parent_permissions (remote, permission_items, &string_stash,
--                             node_global, "r--");
-+                      PERMISSION_ITEM (remote->node_factory_id, PW_PERM_R));
- 
--  append_stream_permissions (remote, permission_items, &string_stash, streams);
-+  append_stream_permissions (remote, permission_items, streams);
- 
--  permission_dict =
--    &SPA_DICT_INIT ((struct spa_dict_item *) permission_items->data,
--                    permission_items->len);
--  pw_core_proxy_permissions (pw_remote_get_core_proxy (remote->remote),
--                             permission_dict);
-+  /*
-+   * Hide all existing and future nodes (except the ones we explicitly list above).
-+   */
-+  g_array_append_val (permission_items,
-+                      PERMISSION_ITEM (PW_ID_ANY, 0));
- 
--  g_list_free_full (string_stash, g_free);
-+  pw_client_update_permissions (pw_core_get_client(remote->core),
-+                                permission_items->len,
-+                                (const struct pw_permission *)permission_items->data);
- 
-   pipewire_remote_roundtrip (remote);
- 
-@@ -943,7 +879,7 @@ handle_open_pipewire_remote (XdpScreenCast *object,
-     }
- 
-   out_fd_list = g_unix_fd_list_new ();
--  fd = pw_remote_steal_fd (remote->remote);
-+  fd = pw_core_steal_fd (remote->core);
-   fd_id = g_unix_fd_list_append (out_fd_list, fd, &error);
-   close (fd);
-   pipewire_remote_destroy (remote);
diff --git a/srcpkgs/xdg-desktop-portal/template b/srcpkgs/xdg-desktop-portal/template
index 1136b6a6e0e..8a39a1afb06 100644
--- a/srcpkgs/xdg-desktop-portal/template
+++ b/srcpkgs/xdg-desktop-portal/template
@@ -1,22 +1,27 @@
 # Template file for 'xdg-desktop-portal'
 pkgname=xdg-desktop-portal
-version=1.6.0
-revision=2
+version=1.8.0
+revision=1
 build_style=gnu-configure
-configure_args="--enable-pipewire --enable-geoclue --disable-libportal"
-hostmakedepends="automake libtool gettext-devel pkg-config glib-devel"
-makedepends="flatpak-devel fuse-devel pipewire-devel geoclue2-devel"
+#make_check_target="check"
+configure_args="--enable-pipewire --enable-geoclue --enable-libportal"
+hostmakedepends="pkg-config glib-devel"
+makedepends="flatpak-devel fuse-devel pipewire-devel geoclue2-devel
+ libportal-devel"
+checkdepends="dbus"
 short_desc="Portal frontend service for Flatpak"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="LGPL-2.1-or-later"
 homepage="https://github.com/flatpak/xdg-desktop-portal"
 distfiles="https://github.com/flatpak/${pkgname}/releases/download/${version}/${pkgname}-${version}.tar.xz"
-checksum=883c9c9a925e48af54812b5347f546dd776ec2e27076a83d5a8126af6bafb9da
+checksum=a2fc5681b3a35078239072a98d6435a4c8404016730cab17c9febfd4ecec3610
 
-pre_configure() {
-	autoreconf -vfi
+# ERROR: test-portals - Bail out! xdg-desktop-portal:ERROR:tests/test-portals.c:156:global_setup: assertion failed (error == NULL): The connection is closed (g-io-error-quark, 18)
+# ERROR: test-permission-store - Bail out! xdg-desktop-portal:ERROR:tests/test-permission-store.c:472:global_setup: assertion failed (error == NULL): The connection is closed (g-io-error-quark, 18)
+do_check() {
+	make check || :
 }
 
 post_install() {
-	rm -rf "${DESTDIR}/usr/lib/systemd"
+	rm -fR "${DESTDIR}/usr/lib/systemd"
 }

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

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

From 633a0fbbbaac08dd7a109f82c7fd51e04945a3c6 Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Mon, 16 Nov 2020 00:59:09 +0300
Subject: [PATCH 4/5] 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 e91d2f9e5631bd63b66cc024a817db9865667c61 Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Thu, 5 Nov 2020 07:24:27 +0300
Subject: [PATCH 5/5] chromium: enable WebRTC screen sharing via PipeWire [ci
 skip]

---
 srcpkgs/chromium/template | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index e9db11e215c..263d4de96ce 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -2,7 +2,7 @@
 pkgname=chromium
 # See http://www.chromium.org/developers/calendar for the latest version
 version=86.0.4240.193
-revision=1
+revision=2
 archs="i686* x86_64* aarch64* armv7l* ppc64le*"
 short_desc="Google's attempt at creating a safer, faster, and more stable browser"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -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)"
@@ -35,14 +36,15 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
- $(vopt_if sndio sndio-devel)"
+ $(vopt_if sndio sndio-devel)
+ $(vopt_if pipewire libpipewire0.2-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
 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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (13 preceding siblings ...)
  2020-11-16 14:15 ` Logarithmus
@ 2020-11-17 14:53 ` Logarithmus
  2020-11-18  4:16 ` Logarithmus
                   ` (36 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-17 14:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2564 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
- [x] libpipewire0.2
- [x] patch chromium's template
- [ ] test building for all archs:
    - [ ] x86_64 - 🚧
    - [ ] i686 - 🚧
    - [x] aarch64 - ignoring because `nocross=yes`
    - [x] armv7l - ignoring because `nocross=yes`
    - [x] x86_64-musl - works with some issues (tested on my laptop: https://youtu.be/HnD5mgPn8gk):
    * 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)
        ❓ https://web.skype.com - not tested yet
        ❓ https://meet.google.com - not tested yet
    - [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

So now I'm building `linux5.9` for `x86_64` with `CONFIG_RT_GROUP_SCHED` disabled.
I hope it will help, but honestly chances are fairly low.

Right now I have `chromium` for `x86_64` & `i386` and `linux5.9` builds running inside my Void Linux DigitalOcean droplet.
They will take a few hours to finish I think.

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: 33127 bytes --]

From 18b0ab5729782c9efc3922b5014391ddba1a6bb6 Mon Sep 17 00:00:00 2001
From: "Issam E. Maghni" <issam.e.maghni@mailbox.org>
Date: Tue, 22 Sep 2020 18:36:38 -0400
Subject: [PATCH 1/4] xdg-desktop-portal: update to 1.8.0

---
 .../patches/pipewire-0.3.patch                | 551 ------------------
 srcpkgs/xdg-desktop-portal/template           |  23 +-
 2 files changed, 14 insertions(+), 560 deletions(-)
 delete mode 100644 srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch

diff --git a/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch b/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch
deleted file mode 100644
index 94ebe083598..00000000000
--- a/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch
+++ /dev/null
@@ -1,551 +0,0 @@
-From a38901e5e7f835efe7b7a06c55790c8c20bc91a2 Mon Sep 17 00:00:00 2001
-From: Wim Taymans <wtaymans@redhat.com>
-Date: Tue, 14 Jan 2020 09:37:09 +0100
-Subject: [PATCH] PipeWire: update to 0.3 API
-
----
- configure.ac      |   2 +-
- src/camera.c      |  24 ++++----
- src/pipewire.c    | 141 +++++++++++++---------------------------------
- src/pipewire.h    |  10 ++--
- src/screen-cast.c |  98 ++++++--------------------------
- 5 files changed, 72 insertions(+), 203 deletions(-)
-
-diff --git configure.ac configure.ac
-index 89902fa..62d7960 100644
---- configure.ac
-+++ configure.ac
-@@ -97,7 +97,7 @@ AC_ARG_ENABLE(pipewire,
- 	      [AS_HELP_STRING([--enable-pipewire],[Enable PipeWire support. Needed for screen cast portal])],
- 	      enable_pipewire=$enableval, enable_pipewire=yes)
- if test x$enable_pipewire = xyes ; then
--	PKG_CHECK_MODULES(PIPEWIRE, [libpipewire-0.2 >= 0.2.6])
-+	PKG_CHECK_MODULES(PIPEWIRE, [libpipewire-0.3 >= 0.2.90])
- 	AC_DEFINE([HAVE_PIPEWIRE],[1], [Define to enable PipeWire support])
- fi
- AM_CONDITIONAL([HAVE_PIPEWIRE],[test "$enable_pipewire" = "yes"])
-diff --git src/camera.c src/camera.c
-index c2b392c..20fe3aa 100644
---- src/camera.c
-+++ src/camera.c
-@@ -141,7 +141,7 @@ open_pipewire_camera_remote (const char *app_id,
-                              GError **error)
- {
-   PipeWireRemote *remote;
--  struct spa_dict_item permission_items[1];
-+  struct pw_permission permission_items[2];
-   struct pw_properties *pipewire_properties;
- 
-   pipewire_properties =
-@@ -158,12 +158,12 @@ open_pipewire_camera_remote (const char *app_id,
-    * Hide all existing and future nodes by default. PipeWire will use the
-    * permission store to set up permissions.
-    */
--  permission_items[0].key = PW_CORE_PROXY_PERMISSIONS_DEFAULT;
--  permission_items[0].value = "---";
-+  permission_items[0] = PW_PERMISSION_INIT (PW_ID_CORE, PW_PERM_RWX);
-+  permission_items[1] = PW_PERMISSION_INIT (PW_ID_ANY, 0);
- 
--  pw_core_proxy_permissions (pw_remote_get_core_proxy (remote->remote),
--                             &SPA_DICT_INIT (permission_items,
--                                             G_N_ELEMENTS (permission_items)));
-+  pw_client_update_permissions (pw_core_get_client(remote->core),
-+                                G_N_ELEMENTS (permission_items),
-+                                permission_items);
- 
-   pipewire_remote_roundtrip (remote);
- 
-@@ -219,7 +219,7 @@ handle_open_pipewire_remote (XdpCamera *object,
-     }
- 
-   out_fd_list = g_unix_fd_list_new ();
--  fd = pw_remote_steal_fd (remote->remote);
-+  fd = pw_core_steal_fd (remote->core);
-   fd_id = g_unix_fd_list_append (out_fd_list, fd, &error);
-   close (fd);
-   pipewire_remote_destroy (remote);
-@@ -250,29 +250,28 @@ camera_iface_init (XdpCameraIface *iface)
- static void
- global_added_cb (PipeWireRemote *remote,
-                  uint32_t id,
--                 uint32_t type,
-+                 const char *type,
-                  const struct spa_dict *props,
-                  gpointer user_data)
- {
-   Camera *camera = user_data;
--  struct pw_type *core_type = pw_core_get_type (remote->core);
-   const struct spa_dict_item *media_class;
-   const struct spa_dict_item *media_role;
- 
--  if (type != core_type->node)
-+  if (strcmp(type, PW_TYPE_INTERFACE_Node) != 0)
-     return;
- 
-   if (!props)
-     return;
- 
--  media_class = spa_dict_lookup_item (props, "media.class");
-+  media_class = spa_dict_lookup_item (props, PW_KEY_MEDIA_CLASS);
-   if (!media_class)
-     return;
- 
-   if (g_strcmp0 (media_class->value, "Video/Source") != 0)
-     return;
- 
--  media_role = spa_dict_lookup_item (props, "media.role");
-+  media_role = spa_dict_lookup_item (props, PW_KEY_MEDIA_ROLE);
-   if (!media_role)
-     return;
- 
-@@ -342,6 +341,7 @@ create_pipewire_remote (Camera *camera,
-     }
- 
-   pipewire_properties = pw_properties_new ("pipewire.access.portal.is_portal", "true",
-+                                           "portal.monitor", "Camera",
-                                            NULL);
-   camera->pipewire_remote = pipewire_remote_new_sync (pipewire_properties,
-                                                       global_added_cb,
-diff --git src/pipewire.c src/pipewire.c
-index 793a378..162cd55 100644
---- src/pipewire.c
-+++ src/pipewire.c
-@@ -21,6 +21,7 @@
- #include <errno.h>
- #include <glib.h>
- #include <pipewire/pipewire.h>
-+#include <spa/utils/result.h>
- 
- #include "pipewire.h"
- 
-@@ -36,27 +37,25 @@ static gboolean is_pipewire_initialized = FALSE;
- static void
- registry_event_global (void *user_data,
-                        uint32_t id,
--                       uint32_t parent_id,
-                        uint32_t permissions,
--                       uint32_t type,
-+                       const char *type,
-                        uint32_t version,
-                        const struct spa_dict *props)
- {
-   PipeWireRemote *remote = user_data;
--  struct pw_type *core_type = pw_core_get_type (remote->core);
-   const struct spa_dict_item *factory_object_type;
-   PipeWireGlobal *global;
- 
-   global = g_new0 (PipeWireGlobal, 1);
-   *global = (PipeWireGlobal) {
--    .parent_id = parent_id,
-+    .parent_id = id,
-   };
- 
-   g_hash_table_insert (remote->globals, GINT_TO_POINTER (id), global);
-   if (remote->global_added_cb)
-     remote->global_added_cb (remote, id, type, props, remote->user_data);
- 
--  if (type != core_type->factory)
-+  if (strcmp(type, PW_TYPE_INTERFACE_Factory) != 0)
-     return;
- 
-   factory_object_type = spa_dict_lookup_item (props, "factory.type.name");
-@@ -81,8 +80,8 @@ registry_event_global_remove (void *user_data,
-   g_hash_table_remove (remote->globals, GINT_TO_POINTER (id));
- }
- 
--static const struct pw_registry_proxy_events registry_events = {
--  PW_VERSION_REGISTRY_PROXY_EVENTS,
-+static const struct pw_registry_events registry_events = {
-+  PW_VERSION_REGISTRY_EVENTS,
-   .global = registry_event_global,
-   .global_remove = registry_event_global_remove,
- };
-@@ -90,7 +89,7 @@ static const struct pw_registry_proxy_events registry_events = {
- void
- pipewire_remote_roundtrip (PipeWireRemote *remote)
- {
--  pw_core_proxy_sync (remote->core_proxy, ++remote->sync_seq);
-+  remote->sync_seq = pw_core_sync (remote->core, PW_ID_CORE, remote->sync_seq);
-   pw_main_loop_run (remote->loop);
- }
- 
-@@ -98,16 +97,13 @@ static gboolean
- discover_node_factory_sync (PipeWireRemote *remote,
-                             GError **error)
- {
--  struct pw_type *core_type = pw_core_get_type (remote->core);
--  struct pw_registry_proxy *registry_proxy;
-+  struct pw_registry *registry;
- 
--  registry_proxy = pw_core_proxy_get_registry (remote->core_proxy,
--                                               core_type->registry,
--                                               PW_VERSION_REGISTRY, 0);
--  pw_registry_proxy_add_listener (registry_proxy,
--                                  &remote->registry_listener,
--                                  &registry_events,
--                                  remote);
-+  registry = pw_core_get_registry (remote->core, PW_VERSION_REGISTRY, 0);
-+  pw_registry_add_listener (registry,
-+                            &remote->registry_listener,
-+                            &registry_events,
-+                            remote);
- 
-   pipewire_remote_roundtrip (remote);
- 
-@@ -122,59 +118,35 @@ discover_node_factory_sync (PipeWireRemote *remote,
- }
- 
- static void
--on_state_changed (void *user_data,
--                  enum pw_remote_state old,
--                  enum pw_remote_state state,
--                  const char *error)
-+core_event_error (void       *user_data,
-+                  uint32_t    id,
-+		  int         seq,
-+		  int         res,
-+		  const char *message)
- {
-   PipeWireRemote *remote = user_data;
- 
--  switch (state)
-+  if (id == PW_ID_CORE)
-     {
--    case PW_REMOTE_STATE_ERROR:
--      if (!remote->error)
--        {
--          g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                       "%s", error);
--        }
-+      g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED,
-+                 "%s", message);
-       pw_main_loop_quit (remote->loop);
--      break;
--    case PW_REMOTE_STATE_UNCONNECTED:
--      if (!remote->error)
--        {
--          g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                       "Disconnected");
--        }
--      pw_main_loop_quit (remote->loop);
--      break;
--    case PW_REMOTE_STATE_CONNECTING:
--      break;
--    case PW_REMOTE_STATE_CONNECTED:
--      pw_main_loop_quit (remote->loop);
--      break;
--    default:
--      g_warning ("Unknown PipeWire state");
--      break;
-     }
- }
- 
--static const struct pw_remote_events remote_events = {
--  PW_VERSION_REMOTE_EVENTS,
--  .state_changed = on_state_changed,
--};
--
- static void
- core_event_done (void *user_data,
--                 uint32_t seq)
-+                 uint32_t id, int seq)
- {
-   PipeWireRemote *remote = user_data;
- 
--  if (remote->sync_seq == seq)
-+  if (id == PW_ID_CORE && remote->sync_seq == seq)
-     pw_main_loop_quit (remote->loop);
- }
- 
--static const struct pw_core_proxy_events core_events = {
--  PW_VERSION_CORE_PROXY_EVENTS,
-+static const struct pw_core_events core_events = {
-+  PW_VERSION_CORE_EVENTS,
-+  .error = core_event_error,
-   .done = core_event_done,
- };
- 
-@@ -237,8 +209,8 @@ void
- pipewire_remote_destroy (PipeWireRemote *remote)
- {
-   g_clear_pointer (&remote->globals, g_hash_table_destroy);
--  g_clear_pointer (&remote->remote, pw_remote_destroy);
--  g_clear_pointer (&remote->core, pw_core_destroy);
-+  g_clear_pointer (&remote->core, pw_core_disconnect);
-+  g_clear_pointer (&remote->context, pw_context_destroy);
-   g_clear_pointer (&remote->loop, pw_main_loop_destroy);
-   g_clear_error (&remote->error);
- 
-@@ -307,68 +279,31 @@ pipewire_remote_new_sync (struct pw_properties *pipewire_properties,
-       return NULL;
-     }
- 
--  remote->core = pw_core_new (pw_main_loop_get_loop (remote->loop), NULL);
--  if (!remote->core)
-+  remote->context = pw_context_new (pw_main_loop_get_loop (remote->loop), NULL, 0);
-+  if (!remote->context)
-     {
-       pipewire_remote_destroy (remote);
-       pw_properties_free (pipewire_properties);
-       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Couldn't create PipeWire core");
-+                   "Couldn't create PipeWire context");
-       return NULL;
-     }
- 
--  remote->remote = pw_remote_new (remote->core, pipewire_properties, 0);
--  if (!remote->remote)
-+  remote->core = pw_context_connect (remote->context, pipewire_properties, 0);
-+  if (!remote->core)
-     {
-       pipewire_remote_destroy (remote);
-       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Couldn't create PipeWire remote");
-+                   "Couldn't connect to PipeWire");
-       return NULL;
-     }
- 
-   remote->globals = g_hash_table_new_full (NULL, NULL, NULL, g_free);
- 
--  pw_remote_add_listener (remote->remote,
--                          &remote->remote_listener,
--                          &remote_events,
--                          remote);
--
--  if (pw_remote_connect (remote->remote) != 0)
--    {
--      pipewire_remote_destroy (remote);
--      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Couldn't connect PipeWire remote");
--      return NULL;
--    }
--
--  pw_main_loop_run (remote->loop);
--
--  switch (pw_remote_get_state (remote->remote, NULL))
--    {
--    case PW_REMOTE_STATE_ERROR:
--    case PW_REMOTE_STATE_UNCONNECTED:
--      *error = g_steal_pointer (&remote->error);
--      pipewire_remote_destroy (remote);
--      return NULL;
--    case PW_REMOTE_STATE_CONNECTING:
--      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "PipeWire loop stopped unexpectedly");
--      pipewire_remote_destroy (remote);
--      return NULL;
--    case PW_REMOTE_STATE_CONNECTED:
--      break;
--    default:
--      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Unexpected PipeWire state");
--      pipewire_remote_destroy (remote);
--      return NULL;
--    }
--
--  remote->core_proxy = pw_remote_get_core_proxy (remote->remote);
--  pw_core_proxy_add_listener (remote->core_proxy,
--                              &remote->core_listener,
--                              &core_events,
--                              remote);
-+  pw_core_add_listener (remote->core,
-+                        &remote->core_listener,
-+                        &core_events,
-+                        remote);
- 
-   if (!discover_node_factory_sync (remote, error))
-     {
-diff --git src/pipewire.h src/pipewire.h
-index 0f1bf54..bf48d5e 100644
---- src/pipewire.h
-+++ src/pipewire.h
-@@ -32,7 +32,7 @@ typedef struct _PipeWireGlobal
- 
- typedef void (* PipeWireGlobalAddedCallback) (PipeWireRemote *remote,
-                                               uint32_t id,
--                                              uint32_t type,
-+                                              const char *type,
-                                               const struct spa_dict *props,
-                                               gpointer user_data);
- 
-@@ -43,13 +43,11 @@ typedef void (* PipeWireGlobalRemovedCallback) (PipeWireRemote *remote,
- struct _PipeWireRemote
- {
-   struct pw_main_loop *loop;
-+  struct pw_context *context;
-   struct pw_core *core;
--  struct pw_remote *remote;
--  struct spa_hook remote_listener;
--
--  struct pw_core_proxy *core_proxy;
-   struct spa_hook core_listener;
--  uint32_t sync_seq;
-+
-+  int sync_seq;
- 
-   struct spa_hook registry_listener;
- 
-diff --git src/screen-cast.c src/screen-cast.c
-index 7881ddc..1677050 100644
---- src/screen-cast.c
-+++ src/screen-cast.c
-@@ -31,10 +31,10 @@
- #include "xdp-impl-dbus.h"
- #include "xdp-utils.h"
- 
--#define PERMISSION_ITEM(item_key, item_value) \
--  ((struct spa_dict_item) { \
--    .key = item_key, \
--    .value = item_value \
-+#define PERMISSION_ITEM(item_id, item_permissions) \
-+  ((struct pw_permission) { \
-+    .id = item_id, \
-+    .permissions = item_permissions \
-   })
- 
- typedef struct _ScreenCast ScreenCast;
-@@ -517,42 +517,9 @@ screen_cast_stream_get_pipewire_node_id (ScreenCastStream *stream)
-   return stream->id;
- }
- 
--static void
--append_parent_permissions (PipeWireRemote *remote,
--                           GArray *permission_items,
--                           GList **string_stash,
--                           PipeWireGlobal *global,
--                           const char *permission)
--{
--  PipeWireGlobal *parent;
--  char *parent_permission_value;
--
--  if (global->parent_id == 0)
--    return;
--
--  parent = g_hash_table_lookup (remote->globals, GINT_TO_POINTER (global->parent_id));
--
--  if (parent->permission_set)
--    return;
--  parent->permission_set = TRUE;
--
--  append_parent_permissions (remote, permission_items, string_stash,
--                             parent, permission);
--
--  parent_permission_value = g_strdup_printf ("%u:%s",
--                                             global->parent_id,
--                                             permission);
--  *string_stash = g_list_prepend (*string_stash, parent_permission_value);
--
--  g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                       parent_permission_value));
--}
--
- static void
- append_stream_permissions (PipeWireRemote *remote,
-                            GArray *permission_items,
--                           GList **string_stash,
-                            GList *streams)
- {
-   GList *l;
-@@ -561,21 +528,10 @@ append_stream_permissions (PipeWireRemote *remote,
-     {
-       ScreenCastStream *stream = l->data;
-       uint32_t stream_id;
--      PipeWireGlobal *stream_global;
--      char *stream_permission_value;
- 
-       stream_id = screen_cast_stream_get_pipewire_node_id (stream);
--      stream_global = g_hash_table_lookup (remote->globals,
--                                           GINT_TO_POINTER (stream_id));
--
--      append_parent_permissions (remote, permission_items, string_stash,
--                                 stream_global, "r--");
--
--      stream_permission_value = g_strdup_printf ("%u:rwx", stream_id);
--      *string_stash = g_list_prepend (*string_stash, stream_permission_value);
-       g_array_append_val (permission_items,
--                          PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                           stream_permission_value));
-+                          PERMISSION_ITEM (stream_id, PW_PERM_RWX));
-     }
- }
- 
-@@ -587,9 +543,6 @@ open_pipewire_screen_cast_remote (const char *app_id,
-   struct pw_properties *pipewire_properties;
-   PipeWireRemote *remote;
-   g_autoptr(GArray) permission_items = NULL;
--  char *node_factory_permission_string;
--  GList *string_stash = NULL;
--  struct spa_dict *permission_dict;
-   PipeWireGlobal *node_global;
- 
-   pipewire_properties = pw_properties_new ("pipewire.access.portal.app_id", app_id,
-@@ -603,48 +556,31 @@ open_pipewire_screen_cast_remote (const char *app_id,
- 
-   permission_items = g_array_new (FALSE, TRUE, sizeof (struct spa_dict_item));
- 
--  /*
--   * Hide all existing and future nodes (except the ones we explicitly list below.
--   */
--  g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_EXISTING,
--                                       "---"));
--  g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_DEFAULT,
--                                       "---"));
--
-   /*
-    * PipeWire:Interface:Core
-    * Needs rwx to be able create the sink node using the create-object method
-    */
-   g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                       "0:rwx"));
-+                      PERMISSION_ITEM (PW_ID_CORE, PW_PERM_RWX));
- 
-   /*
-    * PipeWire:Interface:NodeFactory
-    * Needs r-- so it can be passed to create-object when creating the sink node.
-    */
--  node_factory_permission_string = g_strdup_printf ("%d:r--",
--                                                    remote->node_factory_id);
--  string_stash = g_list_prepend (string_stash, node_factory_permission_string);
-   g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                       node_factory_permission_string));
--  node_global = g_hash_table_lookup (remote->globals,
--                                     GINT_TO_POINTER (remote->node_factory_id));
--  append_parent_permissions (remote, permission_items, &string_stash,
--                             node_global, "r--");
-+                      PERMISSION_ITEM (remote->node_factory_id, PW_PERM_R));
- 
--  append_stream_permissions (remote, permission_items, &string_stash, streams);
-+  append_stream_permissions (remote, permission_items, streams);
- 
--  permission_dict =
--    &SPA_DICT_INIT ((struct spa_dict_item *) permission_items->data,
--                    permission_items->len);
--  pw_core_proxy_permissions (pw_remote_get_core_proxy (remote->remote),
--                             permission_dict);
-+  /*
-+   * Hide all existing and future nodes (except the ones we explicitly list above).
-+   */
-+  g_array_append_val (permission_items,
-+                      PERMISSION_ITEM (PW_ID_ANY, 0));
- 
--  g_list_free_full (string_stash, g_free);
-+  pw_client_update_permissions (pw_core_get_client(remote->core),
-+                                permission_items->len,
-+                                (const struct pw_permission *)permission_items->data);
- 
-   pipewire_remote_roundtrip (remote);
- 
-@@ -943,7 +879,7 @@ handle_open_pipewire_remote (XdpScreenCast *object,
-     }
- 
-   out_fd_list = g_unix_fd_list_new ();
--  fd = pw_remote_steal_fd (remote->remote);
-+  fd = pw_core_steal_fd (remote->core);
-   fd_id = g_unix_fd_list_append (out_fd_list, fd, &error);
-   close (fd);
-   pipewire_remote_destroy (remote);
diff --git a/srcpkgs/xdg-desktop-portal/template b/srcpkgs/xdg-desktop-portal/template
index 1136b6a6e0e..8a39a1afb06 100644
--- a/srcpkgs/xdg-desktop-portal/template
+++ b/srcpkgs/xdg-desktop-portal/template
@@ -1,22 +1,27 @@
 # Template file for 'xdg-desktop-portal'
 pkgname=xdg-desktop-portal
-version=1.6.0
-revision=2
+version=1.8.0
+revision=1
 build_style=gnu-configure
-configure_args="--enable-pipewire --enable-geoclue --disable-libportal"
-hostmakedepends="automake libtool gettext-devel pkg-config glib-devel"
-makedepends="flatpak-devel fuse-devel pipewire-devel geoclue2-devel"
+#make_check_target="check"
+configure_args="--enable-pipewire --enable-geoclue --enable-libportal"
+hostmakedepends="pkg-config glib-devel"
+makedepends="flatpak-devel fuse-devel pipewire-devel geoclue2-devel
+ libportal-devel"
+checkdepends="dbus"
 short_desc="Portal frontend service for Flatpak"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="LGPL-2.1-or-later"
 homepage="https://github.com/flatpak/xdg-desktop-portal"
 distfiles="https://github.com/flatpak/${pkgname}/releases/download/${version}/${pkgname}-${version}.tar.xz"
-checksum=883c9c9a925e48af54812b5347f546dd776ec2e27076a83d5a8126af6bafb9da
+checksum=a2fc5681b3a35078239072a98d6435a4c8404016730cab17c9febfd4ecec3610
 
-pre_configure() {
-	autoreconf -vfi
+# ERROR: test-portals - Bail out! xdg-desktop-portal:ERROR:tests/test-portals.c:156:global_setup: assertion failed (error == NULL): The connection is closed (g-io-error-quark, 18)
+# ERROR: test-permission-store - Bail out! xdg-desktop-portal:ERROR:tests/test-permission-store.c:472:global_setup: assertion failed (error == NULL): The connection is closed (g-io-error-quark, 18)
+do_check() {
+	make check || :
 }
 
 post_install() {
-	rm -rf "${DESTDIR}/usr/lib/systemd"
+	rm -fR "${DESTDIR}/usr/lib/systemd"
 }

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

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

From cafc6f43bb4870ff7871240c1f4a5af99be16d24 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 6cadef120624b515518a4d198dd7461fdd8a9354 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 | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index e9db11e215c..263d4de96ce 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -2,7 +2,7 @@
 pkgname=chromium
 # See http://www.chromium.org/developers/calendar for the latest version
 version=86.0.4240.193
-revision=1
+revision=2
 archs="i686* x86_64* aarch64* armv7l* ppc64le*"
 short_desc="Google's attempt at creating a safer, faster, and more stable browser"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -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)"
@@ -35,14 +36,15 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
- $(vopt_if sndio sndio-devel)"
+ $(vopt_if sndio sndio-devel)
+ $(vopt_if pipewire libpipewire0.2-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
 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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (14 preceding siblings ...)
  2020-11-17 14:53 ` Logarithmus
@ 2020-11-18  4:16 ` Logarithmus
  2020-11-18  4:20 ` Logarithmus
                   ` (35 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-18  4:16 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-729394448

Comment:
@ericonr @q66 @Duncaen @absrd finally, this PR is ready for review.
Related PR (`xdg-desktop-portal-wlr`): https://github.com/void-linux/void-packages/pull/23296

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (15 preceding siblings ...)
  2020-11-18  4:16 ` Logarithmus
@ 2020-11-18  4:20 ` Logarithmus
  2020-11-19  5:41 ` [PR PATCH] [Updated] " Logarithmus
                   ` (34 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-18  4:20 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-729394448

Comment:
@ericonr @q66 @Duncaen, finally, this PR is ready for review.
Related PR by @absrd (`xdg-desktop-portal-wlr`): https://github.com/void-linux/void-packages/pull/23296

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (16 preceding siblings ...)
  2020-11-18  4:20 ` Logarithmus
@ 2020-11-19  5:41 ` Logarithmus
  2020-11-19 20:40 ` [PR PATCH] [Updated] [ci skip] chromium: update to 87.0.4280.66 & " Logarithmus
                   ` (33 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-19  5:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2504 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
- [x] libpipewire0.2
- [x] patch chromium's template
- [x] test for all archs:
    - [x] x86_64 - works: https://youtu.be/AgyxEC7SfGk
    - [x] i686 - works: https://youtu.be/j0MY9C1CwV4
    - [x] aarch64 - ignoring because `nocross=yes`
    - [x] armv7l - ignoring because `nocross=yes`
    - [x] x86_64-musl - works: https://youtu.be/HnD5mgPn8gk
    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: 33228 bytes --]

From 18b0ab5729782c9efc3922b5014391ddba1a6bb6 Mon Sep 17 00:00:00 2001
From: "Issam E. Maghni" <issam.e.maghni@mailbox.org>
Date: Tue, 22 Sep 2020 18:36:38 -0400
Subject: [PATCH 1/4] xdg-desktop-portal: update to 1.8.0

---
 .../patches/pipewire-0.3.patch                | 551 ------------------
 srcpkgs/xdg-desktop-portal/template           |  23 +-
 2 files changed, 14 insertions(+), 560 deletions(-)
 delete mode 100644 srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch

diff --git a/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch b/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch
deleted file mode 100644
index 94ebe083598..00000000000
--- a/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch
+++ /dev/null
@@ -1,551 +0,0 @@
-From a38901e5e7f835efe7b7a06c55790c8c20bc91a2 Mon Sep 17 00:00:00 2001
-From: Wim Taymans <wtaymans@redhat.com>
-Date: Tue, 14 Jan 2020 09:37:09 +0100
-Subject: [PATCH] PipeWire: update to 0.3 API
-
----
- configure.ac      |   2 +-
- src/camera.c      |  24 ++++----
- src/pipewire.c    | 141 +++++++++++++---------------------------------
- src/pipewire.h    |  10 ++--
- src/screen-cast.c |  98 ++++++--------------------------
- 5 files changed, 72 insertions(+), 203 deletions(-)
-
-diff --git configure.ac configure.ac
-index 89902fa..62d7960 100644
---- configure.ac
-+++ configure.ac
-@@ -97,7 +97,7 @@ AC_ARG_ENABLE(pipewire,
- 	      [AS_HELP_STRING([--enable-pipewire],[Enable PipeWire support. Needed for screen cast portal])],
- 	      enable_pipewire=$enableval, enable_pipewire=yes)
- if test x$enable_pipewire = xyes ; then
--	PKG_CHECK_MODULES(PIPEWIRE, [libpipewire-0.2 >= 0.2.6])
-+	PKG_CHECK_MODULES(PIPEWIRE, [libpipewire-0.3 >= 0.2.90])
- 	AC_DEFINE([HAVE_PIPEWIRE],[1], [Define to enable PipeWire support])
- fi
- AM_CONDITIONAL([HAVE_PIPEWIRE],[test "$enable_pipewire" = "yes"])
-diff --git src/camera.c src/camera.c
-index c2b392c..20fe3aa 100644
---- src/camera.c
-+++ src/camera.c
-@@ -141,7 +141,7 @@ open_pipewire_camera_remote (const char *app_id,
-                              GError **error)
- {
-   PipeWireRemote *remote;
--  struct spa_dict_item permission_items[1];
-+  struct pw_permission permission_items[2];
-   struct pw_properties *pipewire_properties;
- 
-   pipewire_properties =
-@@ -158,12 +158,12 @@ open_pipewire_camera_remote (const char *app_id,
-    * Hide all existing and future nodes by default. PipeWire will use the
-    * permission store to set up permissions.
-    */
--  permission_items[0].key = PW_CORE_PROXY_PERMISSIONS_DEFAULT;
--  permission_items[0].value = "---";
-+  permission_items[0] = PW_PERMISSION_INIT (PW_ID_CORE, PW_PERM_RWX);
-+  permission_items[1] = PW_PERMISSION_INIT (PW_ID_ANY, 0);
- 
--  pw_core_proxy_permissions (pw_remote_get_core_proxy (remote->remote),
--                             &SPA_DICT_INIT (permission_items,
--                                             G_N_ELEMENTS (permission_items)));
-+  pw_client_update_permissions (pw_core_get_client(remote->core),
-+                                G_N_ELEMENTS (permission_items),
-+                                permission_items);
- 
-   pipewire_remote_roundtrip (remote);
- 
-@@ -219,7 +219,7 @@ handle_open_pipewire_remote (XdpCamera *object,
-     }
- 
-   out_fd_list = g_unix_fd_list_new ();
--  fd = pw_remote_steal_fd (remote->remote);
-+  fd = pw_core_steal_fd (remote->core);
-   fd_id = g_unix_fd_list_append (out_fd_list, fd, &error);
-   close (fd);
-   pipewire_remote_destroy (remote);
-@@ -250,29 +250,28 @@ camera_iface_init (XdpCameraIface *iface)
- static void
- global_added_cb (PipeWireRemote *remote,
-                  uint32_t id,
--                 uint32_t type,
-+                 const char *type,
-                  const struct spa_dict *props,
-                  gpointer user_data)
- {
-   Camera *camera = user_data;
--  struct pw_type *core_type = pw_core_get_type (remote->core);
-   const struct spa_dict_item *media_class;
-   const struct spa_dict_item *media_role;
- 
--  if (type != core_type->node)
-+  if (strcmp(type, PW_TYPE_INTERFACE_Node) != 0)
-     return;
- 
-   if (!props)
-     return;
- 
--  media_class = spa_dict_lookup_item (props, "media.class");
-+  media_class = spa_dict_lookup_item (props, PW_KEY_MEDIA_CLASS);
-   if (!media_class)
-     return;
- 
-   if (g_strcmp0 (media_class->value, "Video/Source") != 0)
-     return;
- 
--  media_role = spa_dict_lookup_item (props, "media.role");
-+  media_role = spa_dict_lookup_item (props, PW_KEY_MEDIA_ROLE);
-   if (!media_role)
-     return;
- 
-@@ -342,6 +341,7 @@ create_pipewire_remote (Camera *camera,
-     }
- 
-   pipewire_properties = pw_properties_new ("pipewire.access.portal.is_portal", "true",
-+                                           "portal.monitor", "Camera",
-                                            NULL);
-   camera->pipewire_remote = pipewire_remote_new_sync (pipewire_properties,
-                                                       global_added_cb,
-diff --git src/pipewire.c src/pipewire.c
-index 793a378..162cd55 100644
---- src/pipewire.c
-+++ src/pipewire.c
-@@ -21,6 +21,7 @@
- #include <errno.h>
- #include <glib.h>
- #include <pipewire/pipewire.h>
-+#include <spa/utils/result.h>
- 
- #include "pipewire.h"
- 
-@@ -36,27 +37,25 @@ static gboolean is_pipewire_initialized = FALSE;
- static void
- registry_event_global (void *user_data,
-                        uint32_t id,
--                       uint32_t parent_id,
-                        uint32_t permissions,
--                       uint32_t type,
-+                       const char *type,
-                        uint32_t version,
-                        const struct spa_dict *props)
- {
-   PipeWireRemote *remote = user_data;
--  struct pw_type *core_type = pw_core_get_type (remote->core);
-   const struct spa_dict_item *factory_object_type;
-   PipeWireGlobal *global;
- 
-   global = g_new0 (PipeWireGlobal, 1);
-   *global = (PipeWireGlobal) {
--    .parent_id = parent_id,
-+    .parent_id = id,
-   };
- 
-   g_hash_table_insert (remote->globals, GINT_TO_POINTER (id), global);
-   if (remote->global_added_cb)
-     remote->global_added_cb (remote, id, type, props, remote->user_data);
- 
--  if (type != core_type->factory)
-+  if (strcmp(type, PW_TYPE_INTERFACE_Factory) != 0)
-     return;
- 
-   factory_object_type = spa_dict_lookup_item (props, "factory.type.name");
-@@ -81,8 +80,8 @@ registry_event_global_remove (void *user_data,
-   g_hash_table_remove (remote->globals, GINT_TO_POINTER (id));
- }
- 
--static const struct pw_registry_proxy_events registry_events = {
--  PW_VERSION_REGISTRY_PROXY_EVENTS,
-+static const struct pw_registry_events registry_events = {
-+  PW_VERSION_REGISTRY_EVENTS,
-   .global = registry_event_global,
-   .global_remove = registry_event_global_remove,
- };
-@@ -90,7 +89,7 @@ static const struct pw_registry_proxy_events registry_events = {
- void
- pipewire_remote_roundtrip (PipeWireRemote *remote)
- {
--  pw_core_proxy_sync (remote->core_proxy, ++remote->sync_seq);
-+  remote->sync_seq = pw_core_sync (remote->core, PW_ID_CORE, remote->sync_seq);
-   pw_main_loop_run (remote->loop);
- }
- 
-@@ -98,16 +97,13 @@ static gboolean
- discover_node_factory_sync (PipeWireRemote *remote,
-                             GError **error)
- {
--  struct pw_type *core_type = pw_core_get_type (remote->core);
--  struct pw_registry_proxy *registry_proxy;
-+  struct pw_registry *registry;
- 
--  registry_proxy = pw_core_proxy_get_registry (remote->core_proxy,
--                                               core_type->registry,
--                                               PW_VERSION_REGISTRY, 0);
--  pw_registry_proxy_add_listener (registry_proxy,
--                                  &remote->registry_listener,
--                                  &registry_events,
--                                  remote);
-+  registry = pw_core_get_registry (remote->core, PW_VERSION_REGISTRY, 0);
-+  pw_registry_add_listener (registry,
-+                            &remote->registry_listener,
-+                            &registry_events,
-+                            remote);
- 
-   pipewire_remote_roundtrip (remote);
- 
-@@ -122,59 +118,35 @@ discover_node_factory_sync (PipeWireRemote *remote,
- }
- 
- static void
--on_state_changed (void *user_data,
--                  enum pw_remote_state old,
--                  enum pw_remote_state state,
--                  const char *error)
-+core_event_error (void       *user_data,
-+                  uint32_t    id,
-+		  int         seq,
-+		  int         res,
-+		  const char *message)
- {
-   PipeWireRemote *remote = user_data;
- 
--  switch (state)
-+  if (id == PW_ID_CORE)
-     {
--    case PW_REMOTE_STATE_ERROR:
--      if (!remote->error)
--        {
--          g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                       "%s", error);
--        }
-+      g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED,
-+                 "%s", message);
-       pw_main_loop_quit (remote->loop);
--      break;
--    case PW_REMOTE_STATE_UNCONNECTED:
--      if (!remote->error)
--        {
--          g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                       "Disconnected");
--        }
--      pw_main_loop_quit (remote->loop);
--      break;
--    case PW_REMOTE_STATE_CONNECTING:
--      break;
--    case PW_REMOTE_STATE_CONNECTED:
--      pw_main_loop_quit (remote->loop);
--      break;
--    default:
--      g_warning ("Unknown PipeWire state");
--      break;
-     }
- }
- 
--static const struct pw_remote_events remote_events = {
--  PW_VERSION_REMOTE_EVENTS,
--  .state_changed = on_state_changed,
--};
--
- static void
- core_event_done (void *user_data,
--                 uint32_t seq)
-+                 uint32_t id, int seq)
- {
-   PipeWireRemote *remote = user_data;
- 
--  if (remote->sync_seq == seq)
-+  if (id == PW_ID_CORE && remote->sync_seq == seq)
-     pw_main_loop_quit (remote->loop);
- }
- 
--static const struct pw_core_proxy_events core_events = {
--  PW_VERSION_CORE_PROXY_EVENTS,
-+static const struct pw_core_events core_events = {
-+  PW_VERSION_CORE_EVENTS,
-+  .error = core_event_error,
-   .done = core_event_done,
- };
- 
-@@ -237,8 +209,8 @@ void
- pipewire_remote_destroy (PipeWireRemote *remote)
- {
-   g_clear_pointer (&remote->globals, g_hash_table_destroy);
--  g_clear_pointer (&remote->remote, pw_remote_destroy);
--  g_clear_pointer (&remote->core, pw_core_destroy);
-+  g_clear_pointer (&remote->core, pw_core_disconnect);
-+  g_clear_pointer (&remote->context, pw_context_destroy);
-   g_clear_pointer (&remote->loop, pw_main_loop_destroy);
-   g_clear_error (&remote->error);
- 
-@@ -307,68 +279,31 @@ pipewire_remote_new_sync (struct pw_properties *pipewire_properties,
-       return NULL;
-     }
- 
--  remote->core = pw_core_new (pw_main_loop_get_loop (remote->loop), NULL);
--  if (!remote->core)
-+  remote->context = pw_context_new (pw_main_loop_get_loop (remote->loop), NULL, 0);
-+  if (!remote->context)
-     {
-       pipewire_remote_destroy (remote);
-       pw_properties_free (pipewire_properties);
-       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Couldn't create PipeWire core");
-+                   "Couldn't create PipeWire context");
-       return NULL;
-     }
- 
--  remote->remote = pw_remote_new (remote->core, pipewire_properties, 0);
--  if (!remote->remote)
-+  remote->core = pw_context_connect (remote->context, pipewire_properties, 0);
-+  if (!remote->core)
-     {
-       pipewire_remote_destroy (remote);
-       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Couldn't create PipeWire remote");
-+                   "Couldn't connect to PipeWire");
-       return NULL;
-     }
- 
-   remote->globals = g_hash_table_new_full (NULL, NULL, NULL, g_free);
- 
--  pw_remote_add_listener (remote->remote,
--                          &remote->remote_listener,
--                          &remote_events,
--                          remote);
--
--  if (pw_remote_connect (remote->remote) != 0)
--    {
--      pipewire_remote_destroy (remote);
--      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Couldn't connect PipeWire remote");
--      return NULL;
--    }
--
--  pw_main_loop_run (remote->loop);
--
--  switch (pw_remote_get_state (remote->remote, NULL))
--    {
--    case PW_REMOTE_STATE_ERROR:
--    case PW_REMOTE_STATE_UNCONNECTED:
--      *error = g_steal_pointer (&remote->error);
--      pipewire_remote_destroy (remote);
--      return NULL;
--    case PW_REMOTE_STATE_CONNECTING:
--      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "PipeWire loop stopped unexpectedly");
--      pipewire_remote_destroy (remote);
--      return NULL;
--    case PW_REMOTE_STATE_CONNECTED:
--      break;
--    default:
--      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Unexpected PipeWire state");
--      pipewire_remote_destroy (remote);
--      return NULL;
--    }
--
--  remote->core_proxy = pw_remote_get_core_proxy (remote->remote);
--  pw_core_proxy_add_listener (remote->core_proxy,
--                              &remote->core_listener,
--                              &core_events,
--                              remote);
-+  pw_core_add_listener (remote->core,
-+                        &remote->core_listener,
-+                        &core_events,
-+                        remote);
- 
-   if (!discover_node_factory_sync (remote, error))
-     {
-diff --git src/pipewire.h src/pipewire.h
-index 0f1bf54..bf48d5e 100644
---- src/pipewire.h
-+++ src/pipewire.h
-@@ -32,7 +32,7 @@ typedef struct _PipeWireGlobal
- 
- typedef void (* PipeWireGlobalAddedCallback) (PipeWireRemote *remote,
-                                               uint32_t id,
--                                              uint32_t type,
-+                                              const char *type,
-                                               const struct spa_dict *props,
-                                               gpointer user_data);
- 
-@@ -43,13 +43,11 @@ typedef void (* PipeWireGlobalRemovedCallback) (PipeWireRemote *remote,
- struct _PipeWireRemote
- {
-   struct pw_main_loop *loop;
-+  struct pw_context *context;
-   struct pw_core *core;
--  struct pw_remote *remote;
--  struct spa_hook remote_listener;
--
--  struct pw_core_proxy *core_proxy;
-   struct spa_hook core_listener;
--  uint32_t sync_seq;
-+
-+  int sync_seq;
- 
-   struct spa_hook registry_listener;
- 
-diff --git src/screen-cast.c src/screen-cast.c
-index 7881ddc..1677050 100644
---- src/screen-cast.c
-+++ src/screen-cast.c
-@@ -31,10 +31,10 @@
- #include "xdp-impl-dbus.h"
- #include "xdp-utils.h"
- 
--#define PERMISSION_ITEM(item_key, item_value) \
--  ((struct spa_dict_item) { \
--    .key = item_key, \
--    .value = item_value \
-+#define PERMISSION_ITEM(item_id, item_permissions) \
-+  ((struct pw_permission) { \
-+    .id = item_id, \
-+    .permissions = item_permissions \
-   })
- 
- typedef struct _ScreenCast ScreenCast;
-@@ -517,42 +517,9 @@ screen_cast_stream_get_pipewire_node_id (ScreenCastStream *stream)
-   return stream->id;
- }
- 
--static void
--append_parent_permissions (PipeWireRemote *remote,
--                           GArray *permission_items,
--                           GList **string_stash,
--                           PipeWireGlobal *global,
--                           const char *permission)
--{
--  PipeWireGlobal *parent;
--  char *parent_permission_value;
--
--  if (global->parent_id == 0)
--    return;
--
--  parent = g_hash_table_lookup (remote->globals, GINT_TO_POINTER (global->parent_id));
--
--  if (parent->permission_set)
--    return;
--  parent->permission_set = TRUE;
--
--  append_parent_permissions (remote, permission_items, string_stash,
--                             parent, permission);
--
--  parent_permission_value = g_strdup_printf ("%u:%s",
--                                             global->parent_id,
--                                             permission);
--  *string_stash = g_list_prepend (*string_stash, parent_permission_value);
--
--  g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                       parent_permission_value));
--}
--
- static void
- append_stream_permissions (PipeWireRemote *remote,
-                            GArray *permission_items,
--                           GList **string_stash,
-                            GList *streams)
- {
-   GList *l;
-@@ -561,21 +528,10 @@ append_stream_permissions (PipeWireRemote *remote,
-     {
-       ScreenCastStream *stream = l->data;
-       uint32_t stream_id;
--      PipeWireGlobal *stream_global;
--      char *stream_permission_value;
- 
-       stream_id = screen_cast_stream_get_pipewire_node_id (stream);
--      stream_global = g_hash_table_lookup (remote->globals,
--                                           GINT_TO_POINTER (stream_id));
--
--      append_parent_permissions (remote, permission_items, string_stash,
--                                 stream_global, "r--");
--
--      stream_permission_value = g_strdup_printf ("%u:rwx", stream_id);
--      *string_stash = g_list_prepend (*string_stash, stream_permission_value);
-       g_array_append_val (permission_items,
--                          PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                           stream_permission_value));
-+                          PERMISSION_ITEM (stream_id, PW_PERM_RWX));
-     }
- }
- 
-@@ -587,9 +543,6 @@ open_pipewire_screen_cast_remote (const char *app_id,
-   struct pw_properties *pipewire_properties;
-   PipeWireRemote *remote;
-   g_autoptr(GArray) permission_items = NULL;
--  char *node_factory_permission_string;
--  GList *string_stash = NULL;
--  struct spa_dict *permission_dict;
-   PipeWireGlobal *node_global;
- 
-   pipewire_properties = pw_properties_new ("pipewire.access.portal.app_id", app_id,
-@@ -603,48 +556,31 @@ open_pipewire_screen_cast_remote (const char *app_id,
- 
-   permission_items = g_array_new (FALSE, TRUE, sizeof (struct spa_dict_item));
- 
--  /*
--   * Hide all existing and future nodes (except the ones we explicitly list below.
--   */
--  g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_EXISTING,
--                                       "---"));
--  g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_DEFAULT,
--                                       "---"));
--
-   /*
-    * PipeWire:Interface:Core
-    * Needs rwx to be able create the sink node using the create-object method
-    */
-   g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                       "0:rwx"));
-+                      PERMISSION_ITEM (PW_ID_CORE, PW_PERM_RWX));
- 
-   /*
-    * PipeWire:Interface:NodeFactory
-    * Needs r-- so it can be passed to create-object when creating the sink node.
-    */
--  node_factory_permission_string = g_strdup_printf ("%d:r--",
--                                                    remote->node_factory_id);
--  string_stash = g_list_prepend (string_stash, node_factory_permission_string);
-   g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                       node_factory_permission_string));
--  node_global = g_hash_table_lookup (remote->globals,
--                                     GINT_TO_POINTER (remote->node_factory_id));
--  append_parent_permissions (remote, permission_items, &string_stash,
--                             node_global, "r--");
-+                      PERMISSION_ITEM (remote->node_factory_id, PW_PERM_R));
- 
--  append_stream_permissions (remote, permission_items, &string_stash, streams);
-+  append_stream_permissions (remote, permission_items, streams);
- 
--  permission_dict =
--    &SPA_DICT_INIT ((struct spa_dict_item *) permission_items->data,
--                    permission_items->len);
--  pw_core_proxy_permissions (pw_remote_get_core_proxy (remote->remote),
--                             permission_dict);
-+  /*
-+   * Hide all existing and future nodes (except the ones we explicitly list above).
-+   */
-+  g_array_append_val (permission_items,
-+                      PERMISSION_ITEM (PW_ID_ANY, 0));
- 
--  g_list_free_full (string_stash, g_free);
-+  pw_client_update_permissions (pw_core_get_client(remote->core),
-+                                permission_items->len,
-+                                (const struct pw_permission *)permission_items->data);
- 
-   pipewire_remote_roundtrip (remote);
- 
-@@ -943,7 +879,7 @@ handle_open_pipewire_remote (XdpScreenCast *object,
-     }
- 
-   out_fd_list = g_unix_fd_list_new ();
--  fd = pw_remote_steal_fd (remote->remote);
-+  fd = pw_core_steal_fd (remote->core);
-   fd_id = g_unix_fd_list_append (out_fd_list, fd, &error);
-   close (fd);
-   pipewire_remote_destroy (remote);
diff --git a/srcpkgs/xdg-desktop-portal/template b/srcpkgs/xdg-desktop-portal/template
index 1136b6a6e0e..8a39a1afb06 100644
--- a/srcpkgs/xdg-desktop-portal/template
+++ b/srcpkgs/xdg-desktop-portal/template
@@ -1,22 +1,27 @@
 # Template file for 'xdg-desktop-portal'
 pkgname=xdg-desktop-portal
-version=1.6.0
-revision=2
+version=1.8.0
+revision=1
 build_style=gnu-configure
-configure_args="--enable-pipewire --enable-geoclue --disable-libportal"
-hostmakedepends="automake libtool gettext-devel pkg-config glib-devel"
-makedepends="flatpak-devel fuse-devel pipewire-devel geoclue2-devel"
+#make_check_target="check"
+configure_args="--enable-pipewire --enable-geoclue --enable-libportal"
+hostmakedepends="pkg-config glib-devel"
+makedepends="flatpak-devel fuse-devel pipewire-devel geoclue2-devel
+ libportal-devel"
+checkdepends="dbus"
 short_desc="Portal frontend service for Flatpak"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="LGPL-2.1-or-later"
 homepage="https://github.com/flatpak/xdg-desktop-portal"
 distfiles="https://github.com/flatpak/${pkgname}/releases/download/${version}/${pkgname}-${version}.tar.xz"
-checksum=883c9c9a925e48af54812b5347f546dd776ec2e27076a83d5a8126af6bafb9da
+checksum=a2fc5681b3a35078239072a98d6435a4c8404016730cab17c9febfd4ecec3610
 
-pre_configure() {
-	autoreconf -vfi
+# ERROR: test-portals - Bail out! xdg-desktop-portal:ERROR:tests/test-portals.c:156:global_setup: assertion failed (error == NULL): The connection is closed (g-io-error-quark, 18)
+# ERROR: test-permission-store - Bail out! xdg-desktop-portal:ERROR:tests/test-permission-store.c:472:global_setup: assertion failed (error == NULL): The connection is closed (g-io-error-quark, 18)
+do_check() {
+	make check || :
 }
 
 post_install() {
-	rm -rf "${DESTDIR}/usr/lib/systemd"
+	rm -fR "${DESTDIR}/usr/lib/systemd"
 }

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

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

From cafc6f43bb4870ff7871240c1f4a5af99be16d24 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 85c27522938a46210ca995955aedeb3a1a6357c9 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: update to 87.0.4280.66 & enable WebRTC screen
 sharing via PipeWire [ci skip]

---
 srcpkgs/chromium/template | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index e9db11e215c..f293a4354df 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -1,7 +1,7 @@
 # Template file for 'chromium'
 pkgname=chromium
 # See http://www.chromium.org/developers/calendar for the latest version
-version=86.0.4240.193
+version=87.0.4280.66
 revision=1
 archs="i686* x86_64* aarch64* armv7l* ppc64le*"
 short_desc="Google's attempt at creating a safer, faster, and more stable browser"
@@ -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,8 @@ 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 libpipewire0.2-devel
+ python-setuptools xcb-proto
  $(vopt_if sndio sndio-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
@@ -42,7 +44,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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] [ci skip] chromium: update to 87.0.4280.66 & enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (17 preceding siblings ...)
  2020-11-19  5:41 ` [PR PATCH] [Updated] " Logarithmus
@ 2020-11-19 20:40 ` Logarithmus
  2020-11-19 21:54 ` Logarithmus
                   ` (32 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-19 20:40 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2722 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

[ci skip] chromium: update to 87.0.4280.66 & 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`
    - [ ] x86_64-musl - works for Chromium 86: https://youtu.be/HnD5mgPn8gk
    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: 57727 bytes --]

From 2dc67d1f0627432e047177b81534ebbbbb14152a Mon Sep 17 00:00:00 2001
From: "Issam E. Maghni" <issam.e.maghni@mailbox.org>
Date: Tue, 22 Sep 2020 18:36:38 -0400
Subject: [PATCH 1/4] xdg-desktop-portal: update to 1.8.0

---
 .../patches/pipewire-0.3.patch                | 551 ------------------
 srcpkgs/xdg-desktop-portal/template           |  23 +-
 2 files changed, 14 insertions(+), 560 deletions(-)
 delete mode 100644 srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch

diff --git a/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch b/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch
deleted file mode 100644
index 94ebe083598..00000000000
--- a/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch
+++ /dev/null
@@ -1,551 +0,0 @@
-From a38901e5e7f835efe7b7a06c55790c8c20bc91a2 Mon Sep 17 00:00:00 2001
-From: Wim Taymans <wtaymans@redhat.com>
-Date: Tue, 14 Jan 2020 09:37:09 +0100
-Subject: [PATCH] PipeWire: update to 0.3 API
-
----
- configure.ac      |   2 +-
- src/camera.c      |  24 ++++----
- src/pipewire.c    | 141 +++++++++++++---------------------------------
- src/pipewire.h    |  10 ++--
- src/screen-cast.c |  98 ++++++--------------------------
- 5 files changed, 72 insertions(+), 203 deletions(-)
-
-diff --git configure.ac configure.ac
-index 89902fa..62d7960 100644
---- configure.ac
-+++ configure.ac
-@@ -97,7 +97,7 @@ AC_ARG_ENABLE(pipewire,
- 	      [AS_HELP_STRING([--enable-pipewire],[Enable PipeWire support. Needed for screen cast portal])],
- 	      enable_pipewire=$enableval, enable_pipewire=yes)
- if test x$enable_pipewire = xyes ; then
--	PKG_CHECK_MODULES(PIPEWIRE, [libpipewire-0.2 >= 0.2.6])
-+	PKG_CHECK_MODULES(PIPEWIRE, [libpipewire-0.3 >= 0.2.90])
- 	AC_DEFINE([HAVE_PIPEWIRE],[1], [Define to enable PipeWire support])
- fi
- AM_CONDITIONAL([HAVE_PIPEWIRE],[test "$enable_pipewire" = "yes"])
-diff --git src/camera.c src/camera.c
-index c2b392c..20fe3aa 100644
---- src/camera.c
-+++ src/camera.c
-@@ -141,7 +141,7 @@ open_pipewire_camera_remote (const char *app_id,
-                              GError **error)
- {
-   PipeWireRemote *remote;
--  struct spa_dict_item permission_items[1];
-+  struct pw_permission permission_items[2];
-   struct pw_properties *pipewire_properties;
- 
-   pipewire_properties =
-@@ -158,12 +158,12 @@ open_pipewire_camera_remote (const char *app_id,
-    * Hide all existing and future nodes by default. PipeWire will use the
-    * permission store to set up permissions.
-    */
--  permission_items[0].key = PW_CORE_PROXY_PERMISSIONS_DEFAULT;
--  permission_items[0].value = "---";
-+  permission_items[0] = PW_PERMISSION_INIT (PW_ID_CORE, PW_PERM_RWX);
-+  permission_items[1] = PW_PERMISSION_INIT (PW_ID_ANY, 0);
- 
--  pw_core_proxy_permissions (pw_remote_get_core_proxy (remote->remote),
--                             &SPA_DICT_INIT (permission_items,
--                                             G_N_ELEMENTS (permission_items)));
-+  pw_client_update_permissions (pw_core_get_client(remote->core),
-+                                G_N_ELEMENTS (permission_items),
-+                                permission_items);
- 
-   pipewire_remote_roundtrip (remote);
- 
-@@ -219,7 +219,7 @@ handle_open_pipewire_remote (XdpCamera *object,
-     }
- 
-   out_fd_list = g_unix_fd_list_new ();
--  fd = pw_remote_steal_fd (remote->remote);
-+  fd = pw_core_steal_fd (remote->core);
-   fd_id = g_unix_fd_list_append (out_fd_list, fd, &error);
-   close (fd);
-   pipewire_remote_destroy (remote);
-@@ -250,29 +250,28 @@ camera_iface_init (XdpCameraIface *iface)
- static void
- global_added_cb (PipeWireRemote *remote,
-                  uint32_t id,
--                 uint32_t type,
-+                 const char *type,
-                  const struct spa_dict *props,
-                  gpointer user_data)
- {
-   Camera *camera = user_data;
--  struct pw_type *core_type = pw_core_get_type (remote->core);
-   const struct spa_dict_item *media_class;
-   const struct spa_dict_item *media_role;
- 
--  if (type != core_type->node)
-+  if (strcmp(type, PW_TYPE_INTERFACE_Node) != 0)
-     return;
- 
-   if (!props)
-     return;
- 
--  media_class = spa_dict_lookup_item (props, "media.class");
-+  media_class = spa_dict_lookup_item (props, PW_KEY_MEDIA_CLASS);
-   if (!media_class)
-     return;
- 
-   if (g_strcmp0 (media_class->value, "Video/Source") != 0)
-     return;
- 
--  media_role = spa_dict_lookup_item (props, "media.role");
-+  media_role = spa_dict_lookup_item (props, PW_KEY_MEDIA_ROLE);
-   if (!media_role)
-     return;
- 
-@@ -342,6 +341,7 @@ create_pipewire_remote (Camera *camera,
-     }
- 
-   pipewire_properties = pw_properties_new ("pipewire.access.portal.is_portal", "true",
-+                                           "portal.monitor", "Camera",
-                                            NULL);
-   camera->pipewire_remote = pipewire_remote_new_sync (pipewire_properties,
-                                                       global_added_cb,
-diff --git src/pipewire.c src/pipewire.c
-index 793a378..162cd55 100644
---- src/pipewire.c
-+++ src/pipewire.c
-@@ -21,6 +21,7 @@
- #include <errno.h>
- #include <glib.h>
- #include <pipewire/pipewire.h>
-+#include <spa/utils/result.h>
- 
- #include "pipewire.h"
- 
-@@ -36,27 +37,25 @@ static gboolean is_pipewire_initialized = FALSE;
- static void
- registry_event_global (void *user_data,
-                        uint32_t id,
--                       uint32_t parent_id,
-                        uint32_t permissions,
--                       uint32_t type,
-+                       const char *type,
-                        uint32_t version,
-                        const struct spa_dict *props)
- {
-   PipeWireRemote *remote = user_data;
--  struct pw_type *core_type = pw_core_get_type (remote->core);
-   const struct spa_dict_item *factory_object_type;
-   PipeWireGlobal *global;
- 
-   global = g_new0 (PipeWireGlobal, 1);
-   *global = (PipeWireGlobal) {
--    .parent_id = parent_id,
-+    .parent_id = id,
-   };
- 
-   g_hash_table_insert (remote->globals, GINT_TO_POINTER (id), global);
-   if (remote->global_added_cb)
-     remote->global_added_cb (remote, id, type, props, remote->user_data);
- 
--  if (type != core_type->factory)
-+  if (strcmp(type, PW_TYPE_INTERFACE_Factory) != 0)
-     return;
- 
-   factory_object_type = spa_dict_lookup_item (props, "factory.type.name");
-@@ -81,8 +80,8 @@ registry_event_global_remove (void *user_data,
-   g_hash_table_remove (remote->globals, GINT_TO_POINTER (id));
- }
- 
--static const struct pw_registry_proxy_events registry_events = {
--  PW_VERSION_REGISTRY_PROXY_EVENTS,
-+static const struct pw_registry_events registry_events = {
-+  PW_VERSION_REGISTRY_EVENTS,
-   .global = registry_event_global,
-   .global_remove = registry_event_global_remove,
- };
-@@ -90,7 +89,7 @@ static const struct pw_registry_proxy_events registry_events = {
- void
- pipewire_remote_roundtrip (PipeWireRemote *remote)
- {
--  pw_core_proxy_sync (remote->core_proxy, ++remote->sync_seq);
-+  remote->sync_seq = pw_core_sync (remote->core, PW_ID_CORE, remote->sync_seq);
-   pw_main_loop_run (remote->loop);
- }
- 
-@@ -98,16 +97,13 @@ static gboolean
- discover_node_factory_sync (PipeWireRemote *remote,
-                             GError **error)
- {
--  struct pw_type *core_type = pw_core_get_type (remote->core);
--  struct pw_registry_proxy *registry_proxy;
-+  struct pw_registry *registry;
- 
--  registry_proxy = pw_core_proxy_get_registry (remote->core_proxy,
--                                               core_type->registry,
--                                               PW_VERSION_REGISTRY, 0);
--  pw_registry_proxy_add_listener (registry_proxy,
--                                  &remote->registry_listener,
--                                  &registry_events,
--                                  remote);
-+  registry = pw_core_get_registry (remote->core, PW_VERSION_REGISTRY, 0);
-+  pw_registry_add_listener (registry,
-+                            &remote->registry_listener,
-+                            &registry_events,
-+                            remote);
- 
-   pipewire_remote_roundtrip (remote);
- 
-@@ -122,59 +118,35 @@ discover_node_factory_sync (PipeWireRemote *remote,
- }
- 
- static void
--on_state_changed (void *user_data,
--                  enum pw_remote_state old,
--                  enum pw_remote_state state,
--                  const char *error)
-+core_event_error (void       *user_data,
-+                  uint32_t    id,
-+		  int         seq,
-+		  int         res,
-+		  const char *message)
- {
-   PipeWireRemote *remote = user_data;
- 
--  switch (state)
-+  if (id == PW_ID_CORE)
-     {
--    case PW_REMOTE_STATE_ERROR:
--      if (!remote->error)
--        {
--          g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                       "%s", error);
--        }
-+      g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED,
-+                 "%s", message);
-       pw_main_loop_quit (remote->loop);
--      break;
--    case PW_REMOTE_STATE_UNCONNECTED:
--      if (!remote->error)
--        {
--          g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                       "Disconnected");
--        }
--      pw_main_loop_quit (remote->loop);
--      break;
--    case PW_REMOTE_STATE_CONNECTING:
--      break;
--    case PW_REMOTE_STATE_CONNECTED:
--      pw_main_loop_quit (remote->loop);
--      break;
--    default:
--      g_warning ("Unknown PipeWire state");
--      break;
-     }
- }
- 
--static const struct pw_remote_events remote_events = {
--  PW_VERSION_REMOTE_EVENTS,
--  .state_changed = on_state_changed,
--};
--
- static void
- core_event_done (void *user_data,
--                 uint32_t seq)
-+                 uint32_t id, int seq)
- {
-   PipeWireRemote *remote = user_data;
- 
--  if (remote->sync_seq == seq)
-+  if (id == PW_ID_CORE && remote->sync_seq == seq)
-     pw_main_loop_quit (remote->loop);
- }
- 
--static const struct pw_core_proxy_events core_events = {
--  PW_VERSION_CORE_PROXY_EVENTS,
-+static const struct pw_core_events core_events = {
-+  PW_VERSION_CORE_EVENTS,
-+  .error = core_event_error,
-   .done = core_event_done,
- };
- 
-@@ -237,8 +209,8 @@ void
- pipewire_remote_destroy (PipeWireRemote *remote)
- {
-   g_clear_pointer (&remote->globals, g_hash_table_destroy);
--  g_clear_pointer (&remote->remote, pw_remote_destroy);
--  g_clear_pointer (&remote->core, pw_core_destroy);
-+  g_clear_pointer (&remote->core, pw_core_disconnect);
-+  g_clear_pointer (&remote->context, pw_context_destroy);
-   g_clear_pointer (&remote->loop, pw_main_loop_destroy);
-   g_clear_error (&remote->error);
- 
-@@ -307,68 +279,31 @@ pipewire_remote_new_sync (struct pw_properties *pipewire_properties,
-       return NULL;
-     }
- 
--  remote->core = pw_core_new (pw_main_loop_get_loop (remote->loop), NULL);
--  if (!remote->core)
-+  remote->context = pw_context_new (pw_main_loop_get_loop (remote->loop), NULL, 0);
-+  if (!remote->context)
-     {
-       pipewire_remote_destroy (remote);
-       pw_properties_free (pipewire_properties);
-       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Couldn't create PipeWire core");
-+                   "Couldn't create PipeWire context");
-       return NULL;
-     }
- 
--  remote->remote = pw_remote_new (remote->core, pipewire_properties, 0);
--  if (!remote->remote)
-+  remote->core = pw_context_connect (remote->context, pipewire_properties, 0);
-+  if (!remote->core)
-     {
-       pipewire_remote_destroy (remote);
-       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Couldn't create PipeWire remote");
-+                   "Couldn't connect to PipeWire");
-       return NULL;
-     }
- 
-   remote->globals = g_hash_table_new_full (NULL, NULL, NULL, g_free);
- 
--  pw_remote_add_listener (remote->remote,
--                          &remote->remote_listener,
--                          &remote_events,
--                          remote);
--
--  if (pw_remote_connect (remote->remote) != 0)
--    {
--      pipewire_remote_destroy (remote);
--      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Couldn't connect PipeWire remote");
--      return NULL;
--    }
--
--  pw_main_loop_run (remote->loop);
--
--  switch (pw_remote_get_state (remote->remote, NULL))
--    {
--    case PW_REMOTE_STATE_ERROR:
--    case PW_REMOTE_STATE_UNCONNECTED:
--      *error = g_steal_pointer (&remote->error);
--      pipewire_remote_destroy (remote);
--      return NULL;
--    case PW_REMOTE_STATE_CONNECTING:
--      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "PipeWire loop stopped unexpectedly");
--      pipewire_remote_destroy (remote);
--      return NULL;
--    case PW_REMOTE_STATE_CONNECTED:
--      break;
--    default:
--      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Unexpected PipeWire state");
--      pipewire_remote_destroy (remote);
--      return NULL;
--    }
--
--  remote->core_proxy = pw_remote_get_core_proxy (remote->remote);
--  pw_core_proxy_add_listener (remote->core_proxy,
--                              &remote->core_listener,
--                              &core_events,
--                              remote);
-+  pw_core_add_listener (remote->core,
-+                        &remote->core_listener,
-+                        &core_events,
-+                        remote);
- 
-   if (!discover_node_factory_sync (remote, error))
-     {
-diff --git src/pipewire.h src/pipewire.h
-index 0f1bf54..bf48d5e 100644
---- src/pipewire.h
-+++ src/pipewire.h
-@@ -32,7 +32,7 @@ typedef struct _PipeWireGlobal
- 
- typedef void (* PipeWireGlobalAddedCallback) (PipeWireRemote *remote,
-                                               uint32_t id,
--                                              uint32_t type,
-+                                              const char *type,
-                                               const struct spa_dict *props,
-                                               gpointer user_data);
- 
-@@ -43,13 +43,11 @@ typedef void (* PipeWireGlobalRemovedCallback) (PipeWireRemote *remote,
- struct _PipeWireRemote
- {
-   struct pw_main_loop *loop;
-+  struct pw_context *context;
-   struct pw_core *core;
--  struct pw_remote *remote;
--  struct spa_hook remote_listener;
--
--  struct pw_core_proxy *core_proxy;
-   struct spa_hook core_listener;
--  uint32_t sync_seq;
-+
-+  int sync_seq;
- 
-   struct spa_hook registry_listener;
- 
-diff --git src/screen-cast.c src/screen-cast.c
-index 7881ddc..1677050 100644
---- src/screen-cast.c
-+++ src/screen-cast.c
-@@ -31,10 +31,10 @@
- #include "xdp-impl-dbus.h"
- #include "xdp-utils.h"
- 
--#define PERMISSION_ITEM(item_key, item_value) \
--  ((struct spa_dict_item) { \
--    .key = item_key, \
--    .value = item_value \
-+#define PERMISSION_ITEM(item_id, item_permissions) \
-+  ((struct pw_permission) { \
-+    .id = item_id, \
-+    .permissions = item_permissions \
-   })
- 
- typedef struct _ScreenCast ScreenCast;
-@@ -517,42 +517,9 @@ screen_cast_stream_get_pipewire_node_id (ScreenCastStream *stream)
-   return stream->id;
- }
- 
--static void
--append_parent_permissions (PipeWireRemote *remote,
--                           GArray *permission_items,
--                           GList **string_stash,
--                           PipeWireGlobal *global,
--                           const char *permission)
--{
--  PipeWireGlobal *parent;
--  char *parent_permission_value;
--
--  if (global->parent_id == 0)
--    return;
--
--  parent = g_hash_table_lookup (remote->globals, GINT_TO_POINTER (global->parent_id));
--
--  if (parent->permission_set)
--    return;
--  parent->permission_set = TRUE;
--
--  append_parent_permissions (remote, permission_items, string_stash,
--                             parent, permission);
--
--  parent_permission_value = g_strdup_printf ("%u:%s",
--                                             global->parent_id,
--                                             permission);
--  *string_stash = g_list_prepend (*string_stash, parent_permission_value);
--
--  g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                       parent_permission_value));
--}
--
- static void
- append_stream_permissions (PipeWireRemote *remote,
-                            GArray *permission_items,
--                           GList **string_stash,
-                            GList *streams)
- {
-   GList *l;
-@@ -561,21 +528,10 @@ append_stream_permissions (PipeWireRemote *remote,
-     {
-       ScreenCastStream *stream = l->data;
-       uint32_t stream_id;
--      PipeWireGlobal *stream_global;
--      char *stream_permission_value;
- 
-       stream_id = screen_cast_stream_get_pipewire_node_id (stream);
--      stream_global = g_hash_table_lookup (remote->globals,
--                                           GINT_TO_POINTER (stream_id));
--
--      append_parent_permissions (remote, permission_items, string_stash,
--                                 stream_global, "r--");
--
--      stream_permission_value = g_strdup_printf ("%u:rwx", stream_id);
--      *string_stash = g_list_prepend (*string_stash, stream_permission_value);
-       g_array_append_val (permission_items,
--                          PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                           stream_permission_value));
-+                          PERMISSION_ITEM (stream_id, PW_PERM_RWX));
-     }
- }
- 
-@@ -587,9 +543,6 @@ open_pipewire_screen_cast_remote (const char *app_id,
-   struct pw_properties *pipewire_properties;
-   PipeWireRemote *remote;
-   g_autoptr(GArray) permission_items = NULL;
--  char *node_factory_permission_string;
--  GList *string_stash = NULL;
--  struct spa_dict *permission_dict;
-   PipeWireGlobal *node_global;
- 
-   pipewire_properties = pw_properties_new ("pipewire.access.portal.app_id", app_id,
-@@ -603,48 +556,31 @@ open_pipewire_screen_cast_remote (const char *app_id,
- 
-   permission_items = g_array_new (FALSE, TRUE, sizeof (struct spa_dict_item));
- 
--  /*
--   * Hide all existing and future nodes (except the ones we explicitly list below.
--   */
--  g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_EXISTING,
--                                       "---"));
--  g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_DEFAULT,
--                                       "---"));
--
-   /*
-    * PipeWire:Interface:Core
-    * Needs rwx to be able create the sink node using the create-object method
-    */
-   g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                       "0:rwx"));
-+                      PERMISSION_ITEM (PW_ID_CORE, PW_PERM_RWX));
- 
-   /*
-    * PipeWire:Interface:NodeFactory
-    * Needs r-- so it can be passed to create-object when creating the sink node.
-    */
--  node_factory_permission_string = g_strdup_printf ("%d:r--",
--                                                    remote->node_factory_id);
--  string_stash = g_list_prepend (string_stash, node_factory_permission_string);
-   g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                       node_factory_permission_string));
--  node_global = g_hash_table_lookup (remote->globals,
--                                     GINT_TO_POINTER (remote->node_factory_id));
--  append_parent_permissions (remote, permission_items, &string_stash,
--                             node_global, "r--");
-+                      PERMISSION_ITEM (remote->node_factory_id, PW_PERM_R));
- 
--  append_stream_permissions (remote, permission_items, &string_stash, streams);
-+  append_stream_permissions (remote, permission_items, streams);
- 
--  permission_dict =
--    &SPA_DICT_INIT ((struct spa_dict_item *) permission_items->data,
--                    permission_items->len);
--  pw_core_proxy_permissions (pw_remote_get_core_proxy (remote->remote),
--                             permission_dict);
-+  /*
-+   * Hide all existing and future nodes (except the ones we explicitly list above).
-+   */
-+  g_array_append_val (permission_items,
-+                      PERMISSION_ITEM (PW_ID_ANY, 0));
- 
--  g_list_free_full (string_stash, g_free);
-+  pw_client_update_permissions (pw_core_get_client(remote->core),
-+                                permission_items->len,
-+                                (const struct pw_permission *)permission_items->data);
- 
-   pipewire_remote_roundtrip (remote);
- 
-@@ -943,7 +879,7 @@ handle_open_pipewire_remote (XdpScreenCast *object,
-     }
- 
-   out_fd_list = g_unix_fd_list_new ();
--  fd = pw_remote_steal_fd (remote->remote);
-+  fd = pw_core_steal_fd (remote->core);
-   fd_id = g_unix_fd_list_append (out_fd_list, fd, &error);
-   close (fd);
-   pipewire_remote_destroy (remote);
diff --git a/srcpkgs/xdg-desktop-portal/template b/srcpkgs/xdg-desktop-portal/template
index 1136b6a6e0e..8a39a1afb06 100644
--- a/srcpkgs/xdg-desktop-portal/template
+++ b/srcpkgs/xdg-desktop-portal/template
@@ -1,22 +1,27 @@
 # Template file for 'xdg-desktop-portal'
 pkgname=xdg-desktop-portal
-version=1.6.0
-revision=2
+version=1.8.0
+revision=1
 build_style=gnu-configure
-configure_args="--enable-pipewire --enable-geoclue --disable-libportal"
-hostmakedepends="automake libtool gettext-devel pkg-config glib-devel"
-makedepends="flatpak-devel fuse-devel pipewire-devel geoclue2-devel"
+#make_check_target="check"
+configure_args="--enable-pipewire --enable-geoclue --enable-libportal"
+hostmakedepends="pkg-config glib-devel"
+makedepends="flatpak-devel fuse-devel pipewire-devel geoclue2-devel
+ libportal-devel"
+checkdepends="dbus"
 short_desc="Portal frontend service for Flatpak"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="LGPL-2.1-or-later"
 homepage="https://github.com/flatpak/xdg-desktop-portal"
 distfiles="https://github.com/flatpak/${pkgname}/releases/download/${version}/${pkgname}-${version}.tar.xz"
-checksum=883c9c9a925e48af54812b5347f546dd776ec2e27076a83d5a8126af6bafb9da
+checksum=a2fc5681b3a35078239072a98d6435a4c8404016730cab17c9febfd4ecec3610
 
-pre_configure() {
-	autoreconf -vfi
+# ERROR: test-portals - Bail out! xdg-desktop-portal:ERROR:tests/test-portals.c:156:global_setup: assertion failed (error == NULL): The connection is closed (g-io-error-quark, 18)
+# ERROR: test-permission-store - Bail out! xdg-desktop-portal:ERROR:tests/test-permission-store.c:472:global_setup: assertion failed (error == NULL): The connection is closed (g-io-error-quark, 18)
+do_check() {
+	make check || :
 }
 
 post_install() {
-	rm -rf "${DESTDIR}/usr/lib/systemd"
+	rm -fR "${DESTDIR}/usr/lib/systemd"
 }

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

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

From 0af6ca2f0088f7bbe8894250826a9287e8c20128 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 2d8d648298b818f853c20d0e9f5d602af33ef8e8 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: update to 87.0.4280.66 & enable WebRTC screen
 sharing via PipeWire [ci skip]

---
 .../default-pthread-stacksize.patch           |   2 +-
 .../files/musl-patches/no-mallinfo.patch      |  12 +-
 ...remove-unsupported-compiler-warnings.patch |  11 +-
 ...le-accelerated-video-decode-on-Linux.patch |  43 ------
 ...-end-iterator-usage-in-CookieMonster.patch |  78 ----------
 ...k-to-the-i965-driver-if-we-re-on-iHD.patch | 139 ------------------
 ...move-dead-reloc-in-nonalloc-LD-flags.patch |  37 -----
 ...roto-fix-underflow-in-Fp1616ToDouble.patch |  37 -----
 .../chromium/patches/xxx-ppc64le-libvpx.patch |  11 +-
 .../patches/xxx-ppc64le-support.patch         |  13 +-
 srcpkgs/chromium/template                     |  16 +-
 11 files changed, 28 insertions(+), 371 deletions(-)
 delete mode 100644 srcpkgs/chromium/patches/upstream-check-for-enable-accelerated-video-decode-on-Linux.patch
 delete mode 100644 srcpkgs/chromium/patches/upstream-fix-invalid-end-iterator-usage-in-CookieMonster.patch
 delete mode 100644 srcpkgs/chromium/patches/upstream-only-fall-back-to-the-i965-driver-if-we-re-on-iHD.patch
 delete mode 100644 srcpkgs/chromium/patches/upstream-remove-dead-reloc-in-nonalloc-LD-flags.patch
 delete mode 100644 srcpkgs/chromium/patches/upstream-xproto-fix-underflow-in-Fp1616ToDouble.patch

diff --git a/srcpkgs/chromium/files/musl-patches/default-pthread-stacksize.patch b/srcpkgs/chromium/files/musl-patches/default-pthread-stacksize.patch
index 16e4d21e6ed..fb6b2364f67 100644
--- a/srcpkgs/chromium/files/musl-patches/default-pthread-stacksize.patch
+++ b/srcpkgs/chromium/files/musl-patches/default-pthread-stacksize.patch
@@ -1,6 +1,6 @@
 --- base/threading/platform_thread_linux.cc.orig
 +++ base/threading/platform_thread_linux.cc
-@@ -99 +99,2 @@ size_t GetDefaultThreadStackSize(const p
+@@ -379,1 +379,2 @@ size_t GetDefaultThreadStackSize(const p
 -  return 0;
 +  // use 8mb like glibc to avoid running out of space
 +  return (1 << 23);
diff --git a/srcpkgs/chromium/files/musl-patches/no-mallinfo.patch b/srcpkgs/chromium/files/musl-patches/no-mallinfo.patch
index 61d5d7a77ca..9ad984fd774 100644
--- a/srcpkgs/chromium/files/musl-patches/no-mallinfo.patch
+++ b/srcpkgs/chromium/files/musl-patches/no-mallinfo.patch
@@ -1,4 +1,4 @@
---- base/trace_event/malloc_dump_provider.cc.orig
+--- base/trace_event/malloc_dump_provider.cc
 +++ base/trace_event/malloc_dump_provider.cc
 @@ -243,7 +243,7 @@
    allocated_objects_count = main_heap_info.block_count;
@@ -9,14 +9,14 @@
    struct mallinfo info = mallinfo();
    DCHECK_GE(info.arena + info.hblkhd, info.uordblks);
  
---- base/process/process_metrics_posix.cc.orig	2019-10-24 11:10:48.553159245 -0400
+--- base/process/process_metrics_posix.cc	2019-10-24 11:10:48.553159245 -0400
 +++ base/process/process_metrics_posix.cc	2019-10-24 11:14:29.025025854 -0400
-@@ -110,14 +110,14 @@
+@@ -119,14 +119,14 @@
    malloc_statistics_t stats = {0};
    malloc_zone_statistics(nullptr, &stats);
    return stats.size_in_use;
--#elif defined(OS_LINUX) || defined(OS_ANDROID)
-+#elif defined(__GLIBC__) || defined(OS_ANDROID)
+-#elif defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
++#elif defined(__GLIBC__) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
    struct mallinfo minfo = mallinfo();
  #if BUILDFLAG(USE_TCMALLOC)
    return minfo.uordblks;
@@ -29,7 +29,7 @@
    return 0;
  #endif
 --- third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Process.inc
-+++ third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Process.inc.orig
++++ third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Process.inc
 @@ -84,7 +84,7 @@
  }
  
diff --git a/srcpkgs/chromium/patches/llvm-remove-unsupported-compiler-warnings.patch b/srcpkgs/chromium/patches/llvm-remove-unsupported-compiler-warnings.patch
index 86a6e2d8fd7..31e655eca66 100644
--- a/srcpkgs/chromium/patches/llvm-remove-unsupported-compiler-warnings.patch
+++ b/srcpkgs/chromium/patches/llvm-remove-unsupported-compiler-warnings.patch
@@ -1,6 +1,6 @@
---- build/config/compiler/BUILD.gn.orig	2020-10-09 11:20:12.892910174 -0400
-+++ build/config/compiler/BUILD.gn	2020-10-09 11:59:20.403349122 -0400
-@@ -1518,12 +1518,6 @@
+--- build/config/compiler/BUILD.gn
++++ build/config/compiler/BUILD.gn
+@@ -1516,12 +1516,6 @@
          # Flags NaCl (Clang 3.7) and Xcode 9.2 (Clang clang-900.0.39.2) do not
          # recognize.
          cflags += [
@@ -13,16 +13,13 @@
            # TODO(thakis): Only for no_chromium_code? http://crbug.com/912662
            "-Wno-ignored-pragma-optimize",
  
-@@ -1538,25 +1532,12 @@
+@@ -1536,22 +1536,12 @@
  
            # TODO(https://crbug.com/1028110): Evaluate and possible enable.
            "-Wno-deprecated-copy",
 -
 -          # TODO(https://crbug.com/1050281): Clean up, enable.
 -          "-Wno-non-c-typedef-for-linkage",
--
--          # TODO(https://crbug.com/1114873): Clean up, enable.
--          "-Wno-string-concatenation",
          ]
  
          cflags_c += [
diff --git a/srcpkgs/chromium/patches/upstream-check-for-enable-accelerated-video-decode-on-Linux.patch b/srcpkgs/chromium/patches/upstream-check-for-enable-accelerated-video-decode-on-Linux.patch
deleted file mode 100644
index e7d05e84b04..00000000000
--- a/srcpkgs/chromium/patches/upstream-check-for-enable-accelerated-video-decode-on-Linux.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 54deb9811ca9bd2327def5c05ba6987b8c7a0897 Mon Sep 17 00:00:00 2001
-From: Evangelos Foutras <evangelos@foutrelis.com>
-Date: Tue, 29 Sep 2020 01:02:22 +0000
-Subject: [PATCH] Check for enable-accelerated-video-decode on Linux
-
-Video decoding was being accelerated on Linux even though the newly
-added "enable-accelerated-video-decode" flag was not specified. The
-chrome://gpu page was misleadingly showing this feature as disabled:
-
-  > Video Decode: Software only. Hardware acceleration disabled
-
-This change adds a check for --enable-accelerated-video-decode when
-considering if video decoding should be activated. (Only on Linux.)
-
-Extra context: https://crbug.com/1097029#c18 (and also comment 20).
-
-Bug: 1066176, 1097029
-Change-Id: I534115f5f6ceed0ee3511fcf5c2d0f1dd04b9b7e
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2431434
-Reviewed-by: John Abd-El-Malek <jam@chromium.org>
-Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
-Commit-Queue: Ted Meyer <tmathmeyer@chromium.org>
-Cr-Commit-Position: refs/heads/master@{#811480}
----
- content/renderer/render_thread_impl.cc | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
-index f13c94ddab7..0352f127171 100644
---- content/renderer/render_thread_impl.cc
-+++ content/renderer/render_thread_impl.cc
-@@ -1121,7 +1121,11 @@ media::GpuVideoAcceleratorFactories* RenderThreadImpl::GetGpuFactories() {
-           kGpuStreamPriorityMedia);
- 
-   const bool enable_video_accelerator =
-+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
-+      cmd_line->HasSwitch(switches::kEnableAcceleratedVideoDecode) &&
-+#else
-       !cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode) &&
-+#endif  // defined(OS_LINUX) && !defined(OS_CHROMEOS)
-       (gpu_channel_host->gpu_feature_info()
-            .status_values[gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE] ==
-        gpu::kGpuFeatureStatusEnabled);
diff --git a/srcpkgs/chromium/patches/upstream-fix-invalid-end-iterator-usage-in-CookieMonster.patch b/srcpkgs/chromium/patches/upstream-fix-invalid-end-iterator-usage-in-CookieMonster.patch
deleted file mode 100644
index 7494dc9b7c3..00000000000
--- a/srcpkgs/chromium/patches/upstream-fix-invalid-end-iterator-usage-in-CookieMonster.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-From 53478caee862624fc6d73516f8d64253854b146f Mon Sep 17 00:00:00 2001
-From: Piotr Tworek <ptworek@vewd.com>
-Date: Mon, 31 Aug 2020 21:03:58 +0000
-Subject: [PATCH] Fix invalid "end" iterator usage in CookieMonster.
-
-Commit 229623d76e8baf714c8569c9f4efc5de266cef8b has introduced the following
-code in cookie_monster.cc.
-
-// If this is the first cookie in |cookies_| with this key, increment the
-// |num_keys_| counter.
-bool different_prev =
-    inserted == cookies_.begin() || std::prev(inserted)->first != key;
-bool different_next =
-    inserted == cookies_.end() || std::next(inserted)->first != key;
-if (different_prev && different_next)
-  ++num_keys_;
-
-The "inserted" iterator is something that has been returned from
-std::multimap::insert. At first glance it looks reasonable. The code
-tries to determine if there are already similar elements with the same
-key in the map. Unfortunately the expression calculating the value of
-different_next can potentially use the end iterator to the map. The
-"inserted == cookies_.end()" part of the expression will always evaluate
-to false since the newly inserted element has to be in the map and
-cookies_.end() points to the first element outside the map. If the
-inserted happens to be the last element in the map the second part of
-the expression will grab the end iterator by calling std::next(inserted)
-and then will try to use it leading to invalid memory access.
-
-Given the fact that cookies_ is a std::multimap we should not even need
-to calculate the value of different_next. It should always be true.
-
-  "If the container has elements with equivalent key, inserts at the
-  upper bound of that range.(since C++11)"
-
-See: https://en.cppreference.com/w/cpp/container/multimap/insert
-
-Bug: 1120240
-Change-Id: I8928c294ac4daf72349a2331b31b017c1d015da0
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2368872
-Reviewed-by: Maksim Orlovich <morlovich@chromium.org>
-Commit-Queue: Piotr Tworek <ptworek@vewd.com>
-Cr-Commit-Position: refs/heads/master@{#803260}
----
- net/cookies/cookie_monster.cc | 13 +++++++++----
- 1 file changed, 9 insertions(+), 4 deletions(-)
-
-diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc
-index 265deed0e52..140b61a81dc 100644
---- net/cookies/cookie_monster.cc
-+++ net/cookies/cookie_monster.cc
-@@ -1151,9 +1151,14 @@ CookieMonster::CookieMap::iterator CookieMonster::InternalInsertCookie(
-   // |num_keys_| counter.
-   bool different_prev =
-       inserted == cookies_.begin() || std::prev(inserted)->first != key;
--  bool different_next =
--      inserted == cookies_.end() || std::next(inserted)->first != key;
--  if (different_prev && different_next)
-+  // According to std::multiqueue documentation:
-+  // "If the container has elements with equivalent key, inserts at the upper
-+  // bound of that range. (since C++11)"
-+  // This means that "inserted" iterator either points to the last element in
-+  // the map, or the element succeeding it has to have different key.
-+  DCHECK(std::next(inserted) == cookies_.end() ||
-+         std::next(inserted)->first != key);
-+  if (different_prev)
-     ++num_keys_;
- 
-   return inserted;
-@@ -1381,7 +1386,7 @@ void CookieMonster::InternalDeleteCookie(CookieMap::iterator it,
-   bool different_prev =
-       it == cookies_.begin() || std::prev(it)->first != it->first;
-   bool different_next =
--      it == cookies_.end() || std::next(it)->first != it->first;
-+      std::next(it) == cookies_.end() || std::next(it)->first != it->first;
-   if (different_prev && different_next)
-     --num_keys_;
- 
diff --git a/srcpkgs/chromium/patches/upstream-only-fall-back-to-the-i965-driver-if-we-re-on-iHD.patch b/srcpkgs/chromium/patches/upstream-only-fall-back-to-the-i965-driver-if-we-re-on-iHD.patch
deleted file mode 100644
index 5c517e4a8eb..00000000000
--- a/srcpkgs/chromium/patches/upstream-only-fall-back-to-the-i965-driver-if-we-re-on-iHD.patch
+++ /dev/null
@@ -1,139 +0,0 @@
-From fbd756ab55f9351165f923b0411c31dd71319c78 Mon Sep 17 00:00:00 2001
-From: Ted Meyer <tmathmeyer@chromium.org>
-Date: Wed, 16 Sep 2020 17:42:03 +0000
-Subject: [PATCH] Only fall back to the i965 driver if we're on iHD
-
-I got my hands on an old AMD laptop, and the gallium driver worked very
-well and was saving power even at 720p, so there's no reason to block
-that for now.
-
-Bug: 1116703
-Change-Id: Ib15bc2b93f33e99adad7569dd825e167b503a0ea
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2409967
-Commit-Queue: Ted Meyer <tmathmeyer@chromium.org>
-Reviewed-by: Andres Calderon Jaramillo <andrescj@chromium.org>
-Cr-Commit-Position: refs/heads/master@{#807550}
----
- media/gpu/vaapi/vaapi_wrapper.cc | 73 ++++++++++++++++++++------------
- 1 file changed, 47 insertions(+), 26 deletions(-)
-
-diff --git a/media/gpu/vaapi/vaapi_wrapper.cc b/media/gpu/vaapi/vaapi_wrapper.cc
-index 2ad0b997e56..e30d1dfb73b 100644
---- media/gpu/vaapi/vaapi_wrapper.cc
-+++ media/gpu/vaapi/vaapi_wrapper.cc
-@@ -409,6 +409,8 @@ class VADisplayState {
- 
-   // Implementation of Initialize() called only once.
-   bool InitializeOnce() EXCLUSIVE_LOCKS_REQUIRED(va_lock_);
-+  bool InitializeVaDisplay_Locked() EXCLUSIVE_LOCKS_REQUIRED(va_lock_);
-+  bool InitializeVaDriver_Locked() EXCLUSIVE_LOCKS_REQUIRED(va_lock_);
- 
-   int refcount_ GUARDED_BY(va_lock_);
- 
-@@ -472,11 +474,7 @@ bool VADisplayState::Initialize() {
-   return success;
- }
- 
--bool VADisplayState::InitializeOnce() {
--  static_assert(
--      VA_MAJOR_VERSION >= 2 || (VA_MAJOR_VERSION == 1 && VA_MINOR_VERSION >= 1),
--      "Requires VA-API >= 1.1.0");
--
-+bool VADisplayState::InitializeVaDisplay_Locked() {
-   switch (gl::GetGLImplementation()) {
-     case gl::kGLImplementationEGLGLES2:
-       va_display_ = vaGetDisplayDRM(drm_fd_.get());
-@@ -519,25 +517,10 @@ bool VADisplayState::InitializeOnce() {
-     return false;
-   }
- 
--  // Set VA logging level and driver name, unless already set.
--  constexpr char libva_log_level_env[] = "LIBVA_MESSAGING_LEVEL";
--  std::unique_ptr<base::Environment> env(base::Environment::Create());
--  if (!env->HasVar(libva_log_level_env))
--    env->SetVar(libva_log_level_env, "1");
--
--#if defined(USE_X11)
--  if (gl::GetGLImplementation() == gl::kGLImplementationEGLANGLE) {
--    DCHECK(!features::IsUsingOzonePlatform());
--    constexpr char libva_driver_impl_env[] = "LIBVA_DRIVER_NAME";
--    // TODO(crbug/1116703) The libva intel-media driver has a known segfault in
--    // vaPutSurface, so until this is fixed, fall back to the i965 driver. There
--    // is discussion of the issue here:
--    // https://github.com/intel/media-driver/issues/818
--    if (!env->HasVar(libva_driver_impl_env))
--      env->SetVar(libva_driver_impl_env, "i965");
--  }
--#endif  // USE_X11
-+  return true;
-+}
- 
-+bool VADisplayState::InitializeVaDriver_Locked() {
-   // The VAAPI version.
-   int major_version, minor_version;
-   VAStatus va_res = vaInitialize(va_display_, &major_version, &minor_version);
-@@ -545,9 +528,6 @@ bool VADisplayState::InitializeOnce() {
-     LOG(ERROR) << "vaInitialize failed: " << vaErrorStr(va_res);
-     return false;
-   }
--
--  va_initialized_ = true;
--
-   const std::string va_vendor_string = vaQueryVendorString(va_display_);
-   DLOG_IF(WARNING, va_vendor_string.empty())
-       << "Vendor string empty or error reading.";
-@@ -555,6 +535,8 @@ bool VADisplayState::InitializeOnce() {
-            << va_vendor_string;
-   implementation_type_ = VendorStringToImplementationType(va_vendor_string);
- 
-+  va_initialized_ = true;
-+
-   // The VAAPI version is determined from what is loaded on the system by
-   // calling vaInitialize(). Since the libva is now ABI-compatible, relax the
-   // version check which helps in upgrading the libva, without breaking any
-@@ -571,6 +553,45 @@ bool VADisplayState::InitializeOnce() {
-   return true;
- }
- 
-+bool VADisplayState::InitializeOnce() {
-+  static_assert(
-+      VA_MAJOR_VERSION >= 2 || (VA_MAJOR_VERSION == 1 && VA_MINOR_VERSION >= 1),
-+      "Requires VA-API >= 1.1.0");
-+
-+  // Set VA logging level, unless already set.
-+  constexpr char libva_log_level_env[] = "LIBVA_MESSAGING_LEVEL";
-+  std::unique_ptr<base::Environment> env(base::Environment::Create());
-+  if (!env->HasVar(libva_log_level_env))
-+    env->SetVar(libva_log_level_env, "1");
-+
-+  if (!InitializeVaDisplay_Locked() || !InitializeVaDriver_Locked())
-+    return false;
-+
-+#if defined(USE_X11)
-+  if (gl::GetGLImplementation() == gl::kGLImplementationEGLANGLE &&
-+      implementation_type_ == VAImplementation::kIntelIHD) {
-+    DCHECK(!features::IsUsingOzonePlatform());
-+    constexpr char libva_driver_impl_env[] = "LIBVA_DRIVER_NAME";
-+    // TODO(crbug/1116703) The libva intel-media driver has a known segfault in
-+    // vaPutSurface, so until this is fixed, fall back to the i965 driver. There
-+    // is discussion of the issue here:
-+    // https://github.com/intel/media-driver/issues/818
-+    if (!env->HasVar(libva_driver_impl_env))
-+      env->SetVar(libva_driver_impl_env, "i965");
-+
-+    // Re-initialize with the new driver.
-+    va_display_ = nullptr;
-+    va_initialized_ = false;
-+    implementation_type_ = VAImplementation::kInvalid;
-+
-+    if (!InitializeVaDisplay_Locked() || !InitializeVaDriver_Locked())
-+      return false;
-+  }
-+#endif  // USE_X11
-+
-+  return true;
-+}
-+
- VAStatus VADisplayState::Deinitialize() {
-   base::AutoLock auto_lock(va_lock_);
-   VAStatus va_res = VA_STATUS_SUCCESS;
diff --git a/srcpkgs/chromium/patches/upstream-remove-dead-reloc-in-nonalloc-LD-flags.patch b/srcpkgs/chromium/patches/upstream-remove-dead-reloc-in-nonalloc-LD-flags.patch
deleted file mode 100644
index 4ad4f6e23bb..00000000000
--- a/srcpkgs/chromium/patches/upstream-remove-dead-reloc-in-nonalloc-LD-flags.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 74b0cb5b86f7d7f8f7c1172d85b09096bef147b7 Mon Sep 17 00:00:00 2001
-From: Daniel Nicoara <dnicoara@chromium.org>
-Date: Thu, 24 Sep 2020 02:34:24 +0000
-Subject: [PATCH] Remove dead-reloc-in-nonalloc LD flags
-
-Breakpad change landed. Revert workaround.
-
-Bug: 1105559
-Test: components/crash/content/tools/generate_breakpad_symbols.py --build-dir=out/andrd --binary=out/andrd/lib.unstripped/libcontent_shell_content_view.so --symbols-dir=/tmp/foo --platform=android
-Change-Id: I519534002898a97b15a57b9b87ac78ef3f216dee
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2427349
-Commit-Queue: Nico Weber <thakis@chromium.org>
-Reviewed-by: Nico Weber <thakis@chromium.org>
-Cr-Commit-Position: refs/heads/master@{#810066}
----
- build/config/compiler/BUILD.gn | 8 --------
- 1 file changed, 8 deletions(-)
-
-diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
-index aa9eca20bd2..42839cfba3f 100644
---- build/config/compiler/BUILD.gn
-+++ build/config/compiler/BUILD.gn
-@@ -396,14 +396,6 @@ config("compiler") {
-         "-Wl,--as-needed",
-       ]
-     }
--    if (use_lld && !is_chromeos_device) {
--      # TODO(thakis): Fix dump_syms to not need this and then remove it,
--      # https://crbug.com/1105559
--      ldflags += [
--        "-Wl,-z,dead-reloc-in-nonalloc=*=0",
--        "-Wl,-z,dead-reloc-in-nonalloc=.debug_ranges=1",
--      ]
--    }
-   }
- 
-   # Linux-specific compiler flags setup.
diff --git a/srcpkgs/chromium/patches/upstream-xproto-fix-underflow-in-Fp1616ToDouble.patch b/srcpkgs/chromium/patches/upstream-xproto-fix-underflow-in-Fp1616ToDouble.patch
deleted file mode 100644
index 00300a4a919..00000000000
--- a/srcpkgs/chromium/patches/upstream-xproto-fix-underflow-in-Fp1616ToDouble.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 5ade494a9966c7a9675af86dc42aca62fb4d806d Mon Sep 17 00:00:00 2001
-From: Tom Anderson <thomasanderson@chromium.org>
-Date: Wed, 21 Oct 2020 22:02:35 +0000
-Subject: [PATCH] [XProto] Fix underflow in Fp1616ToDouble
-
-x11::Input::Fp1616 should be treated as a signed integer, otherwise
--1 will underflow to 65535.  When dragging a scrollbar, this would
-cause the scrollbar to snap to the bottom when the cursor is dragged
-above the window's y=0 coordinate.  Verified that the issue is fixed
-after this CL.
-
-BUG=1139623,1136352
-R=sky
-
-Change-Id: Ie318006ceadde9b9ce3e267fb453ddeba0e81da0
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2485620
-Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
-Commit-Queue: Scott Violet <sky@chromium.org>
-Reviewed-by: Scott Violet <sky@chromium.org>
-Cr-Commit-Position: refs/heads/master@{#819538}
----
- ui/events/x/events_x_utils.cc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/ui/events/x/events_x_utils.cc b/ui/events/x/events_x_utils.cc
-index 3010db5f40c..856dfb221e7 100644
---- ui/events/x/events_x_utils.cc
-+++ ui/events/x/events_x_utils.cc
-@@ -376,7 +376,7 @@ base::TimeTicks TimeTicksFromXEvent(const x11::Event& xev) {
- 
- // This is ported from libxi's FP1616toDBL in XExtInt.c
- double Fp1616ToDouble(x11::Input::Fp1616 x) {
--  auto x32 = static_cast<uint32_t>(x);
-+  auto x32 = static_cast<int32_t>(x);
-   return x32 * 1.0 / (1 << 16);
- }
- 
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch b/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
index b6a43980c04..422c6859317 100644
--- a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
+++ b/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
@@ -17,7 +17,7 @@ diff --git third_party/libvpx/BUILD.gn third_party/libvpx/BUILD.gn
 index 7198e59..3300485 100644
 --- third_party/libvpx/BUILD.gn
 +++ third_party/libvpx/BUILD.gn
-@@ -336,6 +336,8 @@ static_library("libvpx") {
+@@ -338,6 +338,8 @@ static_library("libvpx") {
      } else {
        sources = libvpx_srcs_arm64
      }
@@ -26,15 +26,6 @@ index 7198e59..3300485 100644
    }
  
    configs -= [ "//build/config/compiler:chromium_code" ]
-@@ -401,6 +403,8 @@ static_library("libvp9rc") {
-     } else {
-       sources = libvpx_srcs_arm64
-     }
-+  } else if (current_cpu == "ppc64") {
-+    sources = libvpx_srcs_ppc64
-   }
-   sources += [ "//third_party/libvpx/source/libvpx/vp9/ratectrl_rtc.cc" ]
-   sources += [ "//third_party/libvpx/source/libvpx/vp9/ratectrl_rtc.h" ]
 diff --git third_party/libvpx/generate_gni.sh third_party/libvpx/generate_gni.sh
 index bcf84b0..8a3f4f1 100755
 --- third_party/libvpx/generate_gni.sh
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
index 1f5fca76ea3..f59716c54f2 100644
--- a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
+++ b/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
@@ -3261,11 +3261,10 @@ index 58bfa8f8..8fc37c46 100644
 +#endif  // !defined(ARCH_CPU_ARM64) && !defined(ARCH_CPU_PPC64)
  #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL)
           sig == SIGILL ||
--#endif  // defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL
-+#endif  // defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL)
+ #endif  // defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL)
           sig == SIGPIPE ||
           sig == SIGSEGV ||
- #if defined(OS_MACOSX)
+ #if defined(OS_APPLE)
 @@ -117,9 +117,11 @@ void CauseSignal(int sig) {
        break;
      }
@@ -3542,11 +3541,9 @@ index 122e26ad..ec21dcb5 100644
  #   define SQLITE_BYTEORDER    1234
  # elif defined(sparc)     || defined(__ppc__) || \
         defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git third_party/webrtc/modules/desktop_capture/differ_block.cc third_party/webrtc/modules/desktop_capture/differ_block.cc
-index dd9ab457..c005d959 100644
 --- third_party/webrtc/modules/desktop_capture/differ_block.cc
 +++ third_party/webrtc/modules/desktop_capture/differ_block.cc
-@@ -30,11 +30,7 @@ bool VectorDifference(const uint8_t* image1, const uint8_t* image2) {
+@@ -30,11 +30,7 @@
    static bool (*diff_proc)(const uint8_t*, const uint8_t*) = nullptr;
  
    if (!diff_proc) {
@@ -3556,10 +3553,10 @@ index dd9ab457..c005d959 100644
 -    diff_proc = &VectorDifference_C;
 -#else
 +#if defined(WEBRTC_ARCH_X86_FAMILY)
-     bool have_sse2 = WebRtc_GetCPUInfo(kSSE2) != 0;
+     bool have_sse2 = GetCPUInfo(kSSE2) != 0;
      // For x86 processors, check if SSE2 is supported.
      if (have_sse2 && kBlockSize == 32) {
-@@ -44,6 +40,10 @@ bool VectorDifference(const uint8_t* image1, const uint8_t* image2) {
+@@ -40,6 +40,10 @@
      } else {
        diff_proc = &VectorDifference_C;
      }
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index e9db11e215c..26fec70ff78 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -1,7 +1,7 @@
 # Template file for 'chromium'
 pkgname=chromium
 # See http://www.chromium.org/developers/calendar for the latest version
-version=86.0.4240.193
+version=87.0.4280.66
 revision=1
 archs="i686* x86_64* aarch64* armv7l* ppc64le*"
 short_desc="Google's attempt at creating a safer, faster, and more stable browser"
@@ -9,19 +9,20 @@ maintainer="Enno Boland <gottox@voidlinux.org>"
 license="BSD-3-Clause"
 homepage="https://www.chromium.org/"
 distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz"
-checksum=203dd5097f5873cb4881e2e838034f0dac5ff13e7fafa286baf87937f8eca534
+checksum=29a8e4ea82edec2fdcf34ece68323bec7ab90f3d5669e6b77f58cff9c278f741
 nocross=yes
 
 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,8 @@ 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 libpipewire0.2-devel
+ python-setuptools xcb-proto
  $(vopt_if sndio sndio-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
@@ -42,7 +44,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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] [ci skip] chromium: update to 87.0.4280.66 & enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (18 preceding siblings ...)
  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
                   ` (31 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-19 21:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2722 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

[ci skip] chromium: update to 87.0.4280.66 & 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`
    - [ ] x86_64-musl - works for Chromium 86: https://youtu.be/HnD5mgPn8gk
    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: 32870 bytes --]

From be35cffd92c549c706b85eae2cb4facf93ed5c66 Mon Sep 17 00:00:00 2001
From: "Issam E. Maghni" <issam.e.maghni@mailbox.org>
Date: Tue, 22 Sep 2020 18:36:38 -0400
Subject: [PATCH 1/4] xdg-desktop-portal: update to 1.8.0

---
 .../patches/pipewire-0.3.patch                | 551 ------------------
 srcpkgs/xdg-desktop-portal/template           |  23 +-
 2 files changed, 14 insertions(+), 560 deletions(-)
 delete mode 100644 srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch

diff --git a/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch b/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch
deleted file mode 100644
index 94ebe083598..00000000000
--- a/srcpkgs/xdg-desktop-portal/patches/pipewire-0.3.patch
+++ /dev/null
@@ -1,551 +0,0 @@
-From a38901e5e7f835efe7b7a06c55790c8c20bc91a2 Mon Sep 17 00:00:00 2001
-From: Wim Taymans <wtaymans@redhat.com>
-Date: Tue, 14 Jan 2020 09:37:09 +0100
-Subject: [PATCH] PipeWire: update to 0.3 API
-
----
- configure.ac      |   2 +-
- src/camera.c      |  24 ++++----
- src/pipewire.c    | 141 +++++++++++++---------------------------------
- src/pipewire.h    |  10 ++--
- src/screen-cast.c |  98 ++++++--------------------------
- 5 files changed, 72 insertions(+), 203 deletions(-)
-
-diff --git configure.ac configure.ac
-index 89902fa..62d7960 100644
---- configure.ac
-+++ configure.ac
-@@ -97,7 +97,7 @@ AC_ARG_ENABLE(pipewire,
- 	      [AS_HELP_STRING([--enable-pipewire],[Enable PipeWire support. Needed for screen cast portal])],
- 	      enable_pipewire=$enableval, enable_pipewire=yes)
- if test x$enable_pipewire = xyes ; then
--	PKG_CHECK_MODULES(PIPEWIRE, [libpipewire-0.2 >= 0.2.6])
-+	PKG_CHECK_MODULES(PIPEWIRE, [libpipewire-0.3 >= 0.2.90])
- 	AC_DEFINE([HAVE_PIPEWIRE],[1], [Define to enable PipeWire support])
- fi
- AM_CONDITIONAL([HAVE_PIPEWIRE],[test "$enable_pipewire" = "yes"])
-diff --git src/camera.c src/camera.c
-index c2b392c..20fe3aa 100644
---- src/camera.c
-+++ src/camera.c
-@@ -141,7 +141,7 @@ open_pipewire_camera_remote (const char *app_id,
-                              GError **error)
- {
-   PipeWireRemote *remote;
--  struct spa_dict_item permission_items[1];
-+  struct pw_permission permission_items[2];
-   struct pw_properties *pipewire_properties;
- 
-   pipewire_properties =
-@@ -158,12 +158,12 @@ open_pipewire_camera_remote (const char *app_id,
-    * Hide all existing and future nodes by default. PipeWire will use the
-    * permission store to set up permissions.
-    */
--  permission_items[0].key = PW_CORE_PROXY_PERMISSIONS_DEFAULT;
--  permission_items[0].value = "---";
-+  permission_items[0] = PW_PERMISSION_INIT (PW_ID_CORE, PW_PERM_RWX);
-+  permission_items[1] = PW_PERMISSION_INIT (PW_ID_ANY, 0);
- 
--  pw_core_proxy_permissions (pw_remote_get_core_proxy (remote->remote),
--                             &SPA_DICT_INIT (permission_items,
--                                             G_N_ELEMENTS (permission_items)));
-+  pw_client_update_permissions (pw_core_get_client(remote->core),
-+                                G_N_ELEMENTS (permission_items),
-+                                permission_items);
- 
-   pipewire_remote_roundtrip (remote);
- 
-@@ -219,7 +219,7 @@ handle_open_pipewire_remote (XdpCamera *object,
-     }
- 
-   out_fd_list = g_unix_fd_list_new ();
--  fd = pw_remote_steal_fd (remote->remote);
-+  fd = pw_core_steal_fd (remote->core);
-   fd_id = g_unix_fd_list_append (out_fd_list, fd, &error);
-   close (fd);
-   pipewire_remote_destroy (remote);
-@@ -250,29 +250,28 @@ camera_iface_init (XdpCameraIface *iface)
- static void
- global_added_cb (PipeWireRemote *remote,
-                  uint32_t id,
--                 uint32_t type,
-+                 const char *type,
-                  const struct spa_dict *props,
-                  gpointer user_data)
- {
-   Camera *camera = user_data;
--  struct pw_type *core_type = pw_core_get_type (remote->core);
-   const struct spa_dict_item *media_class;
-   const struct spa_dict_item *media_role;
- 
--  if (type != core_type->node)
-+  if (strcmp(type, PW_TYPE_INTERFACE_Node) != 0)
-     return;
- 
-   if (!props)
-     return;
- 
--  media_class = spa_dict_lookup_item (props, "media.class");
-+  media_class = spa_dict_lookup_item (props, PW_KEY_MEDIA_CLASS);
-   if (!media_class)
-     return;
- 
-   if (g_strcmp0 (media_class->value, "Video/Source") != 0)
-     return;
- 
--  media_role = spa_dict_lookup_item (props, "media.role");
-+  media_role = spa_dict_lookup_item (props, PW_KEY_MEDIA_ROLE);
-   if (!media_role)
-     return;
- 
-@@ -342,6 +341,7 @@ create_pipewire_remote (Camera *camera,
-     }
- 
-   pipewire_properties = pw_properties_new ("pipewire.access.portal.is_portal", "true",
-+                                           "portal.monitor", "Camera",
-                                            NULL);
-   camera->pipewire_remote = pipewire_remote_new_sync (pipewire_properties,
-                                                       global_added_cb,
-diff --git src/pipewire.c src/pipewire.c
-index 793a378..162cd55 100644
---- src/pipewire.c
-+++ src/pipewire.c
-@@ -21,6 +21,7 @@
- #include <errno.h>
- #include <glib.h>
- #include <pipewire/pipewire.h>
-+#include <spa/utils/result.h>
- 
- #include "pipewire.h"
- 
-@@ -36,27 +37,25 @@ static gboolean is_pipewire_initialized = FALSE;
- static void
- registry_event_global (void *user_data,
-                        uint32_t id,
--                       uint32_t parent_id,
-                        uint32_t permissions,
--                       uint32_t type,
-+                       const char *type,
-                        uint32_t version,
-                        const struct spa_dict *props)
- {
-   PipeWireRemote *remote = user_data;
--  struct pw_type *core_type = pw_core_get_type (remote->core);
-   const struct spa_dict_item *factory_object_type;
-   PipeWireGlobal *global;
- 
-   global = g_new0 (PipeWireGlobal, 1);
-   *global = (PipeWireGlobal) {
--    .parent_id = parent_id,
-+    .parent_id = id,
-   };
- 
-   g_hash_table_insert (remote->globals, GINT_TO_POINTER (id), global);
-   if (remote->global_added_cb)
-     remote->global_added_cb (remote, id, type, props, remote->user_data);
- 
--  if (type != core_type->factory)
-+  if (strcmp(type, PW_TYPE_INTERFACE_Factory) != 0)
-     return;
- 
-   factory_object_type = spa_dict_lookup_item (props, "factory.type.name");
-@@ -81,8 +80,8 @@ registry_event_global_remove (void *user_data,
-   g_hash_table_remove (remote->globals, GINT_TO_POINTER (id));
- }
- 
--static const struct pw_registry_proxy_events registry_events = {
--  PW_VERSION_REGISTRY_PROXY_EVENTS,
-+static const struct pw_registry_events registry_events = {
-+  PW_VERSION_REGISTRY_EVENTS,
-   .global = registry_event_global,
-   .global_remove = registry_event_global_remove,
- };
-@@ -90,7 +89,7 @@ static const struct pw_registry_proxy_events registry_events = {
- void
- pipewire_remote_roundtrip (PipeWireRemote *remote)
- {
--  pw_core_proxy_sync (remote->core_proxy, ++remote->sync_seq);
-+  remote->sync_seq = pw_core_sync (remote->core, PW_ID_CORE, remote->sync_seq);
-   pw_main_loop_run (remote->loop);
- }
- 
-@@ -98,16 +97,13 @@ static gboolean
- discover_node_factory_sync (PipeWireRemote *remote,
-                             GError **error)
- {
--  struct pw_type *core_type = pw_core_get_type (remote->core);
--  struct pw_registry_proxy *registry_proxy;
-+  struct pw_registry *registry;
- 
--  registry_proxy = pw_core_proxy_get_registry (remote->core_proxy,
--                                               core_type->registry,
--                                               PW_VERSION_REGISTRY, 0);
--  pw_registry_proxy_add_listener (registry_proxy,
--                                  &remote->registry_listener,
--                                  &registry_events,
--                                  remote);
-+  registry = pw_core_get_registry (remote->core, PW_VERSION_REGISTRY, 0);
-+  pw_registry_add_listener (registry,
-+                            &remote->registry_listener,
-+                            &registry_events,
-+                            remote);
- 
-   pipewire_remote_roundtrip (remote);
- 
-@@ -122,59 +118,35 @@ discover_node_factory_sync (PipeWireRemote *remote,
- }
- 
- static void
--on_state_changed (void *user_data,
--                  enum pw_remote_state old,
--                  enum pw_remote_state state,
--                  const char *error)
-+core_event_error (void       *user_data,
-+                  uint32_t    id,
-+		  int         seq,
-+		  int         res,
-+		  const char *message)
- {
-   PipeWireRemote *remote = user_data;
- 
--  switch (state)
-+  if (id == PW_ID_CORE)
-     {
--    case PW_REMOTE_STATE_ERROR:
--      if (!remote->error)
--        {
--          g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                       "%s", error);
--        }
-+      g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED,
-+                 "%s", message);
-       pw_main_loop_quit (remote->loop);
--      break;
--    case PW_REMOTE_STATE_UNCONNECTED:
--      if (!remote->error)
--        {
--          g_set_error (&remote->error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                       "Disconnected");
--        }
--      pw_main_loop_quit (remote->loop);
--      break;
--    case PW_REMOTE_STATE_CONNECTING:
--      break;
--    case PW_REMOTE_STATE_CONNECTED:
--      pw_main_loop_quit (remote->loop);
--      break;
--    default:
--      g_warning ("Unknown PipeWire state");
--      break;
-     }
- }
- 
--static const struct pw_remote_events remote_events = {
--  PW_VERSION_REMOTE_EVENTS,
--  .state_changed = on_state_changed,
--};
--
- static void
- core_event_done (void *user_data,
--                 uint32_t seq)
-+                 uint32_t id, int seq)
- {
-   PipeWireRemote *remote = user_data;
- 
--  if (remote->sync_seq == seq)
-+  if (id == PW_ID_CORE && remote->sync_seq == seq)
-     pw_main_loop_quit (remote->loop);
- }
- 
--static const struct pw_core_proxy_events core_events = {
--  PW_VERSION_CORE_PROXY_EVENTS,
-+static const struct pw_core_events core_events = {
-+  PW_VERSION_CORE_EVENTS,
-+  .error = core_event_error,
-   .done = core_event_done,
- };
- 
-@@ -237,8 +209,8 @@ void
- pipewire_remote_destroy (PipeWireRemote *remote)
- {
-   g_clear_pointer (&remote->globals, g_hash_table_destroy);
--  g_clear_pointer (&remote->remote, pw_remote_destroy);
--  g_clear_pointer (&remote->core, pw_core_destroy);
-+  g_clear_pointer (&remote->core, pw_core_disconnect);
-+  g_clear_pointer (&remote->context, pw_context_destroy);
-   g_clear_pointer (&remote->loop, pw_main_loop_destroy);
-   g_clear_error (&remote->error);
- 
-@@ -307,68 +279,31 @@ pipewire_remote_new_sync (struct pw_properties *pipewire_properties,
-       return NULL;
-     }
- 
--  remote->core = pw_core_new (pw_main_loop_get_loop (remote->loop), NULL);
--  if (!remote->core)
-+  remote->context = pw_context_new (pw_main_loop_get_loop (remote->loop), NULL, 0);
-+  if (!remote->context)
-     {
-       pipewire_remote_destroy (remote);
-       pw_properties_free (pipewire_properties);
-       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Couldn't create PipeWire core");
-+                   "Couldn't create PipeWire context");
-       return NULL;
-     }
- 
--  remote->remote = pw_remote_new (remote->core, pipewire_properties, 0);
--  if (!remote->remote)
-+  remote->core = pw_context_connect (remote->context, pipewire_properties, 0);
-+  if (!remote->core)
-     {
-       pipewire_remote_destroy (remote);
-       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Couldn't create PipeWire remote");
-+                   "Couldn't connect to PipeWire");
-       return NULL;
-     }
- 
-   remote->globals = g_hash_table_new_full (NULL, NULL, NULL, g_free);
- 
--  pw_remote_add_listener (remote->remote,
--                          &remote->remote_listener,
--                          &remote_events,
--                          remote);
--
--  if (pw_remote_connect (remote->remote) != 0)
--    {
--      pipewire_remote_destroy (remote);
--      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Couldn't connect PipeWire remote");
--      return NULL;
--    }
--
--  pw_main_loop_run (remote->loop);
--
--  switch (pw_remote_get_state (remote->remote, NULL))
--    {
--    case PW_REMOTE_STATE_ERROR:
--    case PW_REMOTE_STATE_UNCONNECTED:
--      *error = g_steal_pointer (&remote->error);
--      pipewire_remote_destroy (remote);
--      return NULL;
--    case PW_REMOTE_STATE_CONNECTING:
--      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "PipeWire loop stopped unexpectedly");
--      pipewire_remote_destroy (remote);
--      return NULL;
--    case PW_REMOTE_STATE_CONNECTED:
--      break;
--    default:
--      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
--                   "Unexpected PipeWire state");
--      pipewire_remote_destroy (remote);
--      return NULL;
--    }
--
--  remote->core_proxy = pw_remote_get_core_proxy (remote->remote);
--  pw_core_proxy_add_listener (remote->core_proxy,
--                              &remote->core_listener,
--                              &core_events,
--                              remote);
-+  pw_core_add_listener (remote->core,
-+                        &remote->core_listener,
-+                        &core_events,
-+                        remote);
- 
-   if (!discover_node_factory_sync (remote, error))
-     {
-diff --git src/pipewire.h src/pipewire.h
-index 0f1bf54..bf48d5e 100644
---- src/pipewire.h
-+++ src/pipewire.h
-@@ -32,7 +32,7 @@ typedef struct _PipeWireGlobal
- 
- typedef void (* PipeWireGlobalAddedCallback) (PipeWireRemote *remote,
-                                               uint32_t id,
--                                              uint32_t type,
-+                                              const char *type,
-                                               const struct spa_dict *props,
-                                               gpointer user_data);
- 
-@@ -43,13 +43,11 @@ typedef void (* PipeWireGlobalRemovedCallback) (PipeWireRemote *remote,
- struct _PipeWireRemote
- {
-   struct pw_main_loop *loop;
-+  struct pw_context *context;
-   struct pw_core *core;
--  struct pw_remote *remote;
--  struct spa_hook remote_listener;
--
--  struct pw_core_proxy *core_proxy;
-   struct spa_hook core_listener;
--  uint32_t sync_seq;
-+
-+  int sync_seq;
- 
-   struct spa_hook registry_listener;
- 
-diff --git src/screen-cast.c src/screen-cast.c
-index 7881ddc..1677050 100644
---- src/screen-cast.c
-+++ src/screen-cast.c
-@@ -31,10 +31,10 @@
- #include "xdp-impl-dbus.h"
- #include "xdp-utils.h"
- 
--#define PERMISSION_ITEM(item_key, item_value) \
--  ((struct spa_dict_item) { \
--    .key = item_key, \
--    .value = item_value \
-+#define PERMISSION_ITEM(item_id, item_permissions) \
-+  ((struct pw_permission) { \
-+    .id = item_id, \
-+    .permissions = item_permissions \
-   })
- 
- typedef struct _ScreenCast ScreenCast;
-@@ -517,42 +517,9 @@ screen_cast_stream_get_pipewire_node_id (ScreenCastStream *stream)
-   return stream->id;
- }
- 
--static void
--append_parent_permissions (PipeWireRemote *remote,
--                           GArray *permission_items,
--                           GList **string_stash,
--                           PipeWireGlobal *global,
--                           const char *permission)
--{
--  PipeWireGlobal *parent;
--  char *parent_permission_value;
--
--  if (global->parent_id == 0)
--    return;
--
--  parent = g_hash_table_lookup (remote->globals, GINT_TO_POINTER (global->parent_id));
--
--  if (parent->permission_set)
--    return;
--  parent->permission_set = TRUE;
--
--  append_parent_permissions (remote, permission_items, string_stash,
--                             parent, permission);
--
--  parent_permission_value = g_strdup_printf ("%u:%s",
--                                             global->parent_id,
--                                             permission);
--  *string_stash = g_list_prepend (*string_stash, parent_permission_value);
--
--  g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                       parent_permission_value));
--}
--
- static void
- append_stream_permissions (PipeWireRemote *remote,
-                            GArray *permission_items,
--                           GList **string_stash,
-                            GList *streams)
- {
-   GList *l;
-@@ -561,21 +528,10 @@ append_stream_permissions (PipeWireRemote *remote,
-     {
-       ScreenCastStream *stream = l->data;
-       uint32_t stream_id;
--      PipeWireGlobal *stream_global;
--      char *stream_permission_value;
- 
-       stream_id = screen_cast_stream_get_pipewire_node_id (stream);
--      stream_global = g_hash_table_lookup (remote->globals,
--                                           GINT_TO_POINTER (stream_id));
--
--      append_parent_permissions (remote, permission_items, string_stash,
--                                 stream_global, "r--");
--
--      stream_permission_value = g_strdup_printf ("%u:rwx", stream_id);
--      *string_stash = g_list_prepend (*string_stash, stream_permission_value);
-       g_array_append_val (permission_items,
--                          PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                           stream_permission_value));
-+                          PERMISSION_ITEM (stream_id, PW_PERM_RWX));
-     }
- }
- 
-@@ -587,9 +543,6 @@ open_pipewire_screen_cast_remote (const char *app_id,
-   struct pw_properties *pipewire_properties;
-   PipeWireRemote *remote;
-   g_autoptr(GArray) permission_items = NULL;
--  char *node_factory_permission_string;
--  GList *string_stash = NULL;
--  struct spa_dict *permission_dict;
-   PipeWireGlobal *node_global;
- 
-   pipewire_properties = pw_properties_new ("pipewire.access.portal.app_id", app_id,
-@@ -603,48 +556,31 @@ open_pipewire_screen_cast_remote (const char *app_id,
- 
-   permission_items = g_array_new (FALSE, TRUE, sizeof (struct spa_dict_item));
- 
--  /*
--   * Hide all existing and future nodes (except the ones we explicitly list below.
--   */
--  g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_EXISTING,
--                                       "---"));
--  g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_DEFAULT,
--                                       "---"));
--
-   /*
-    * PipeWire:Interface:Core
-    * Needs rwx to be able create the sink node using the create-object method
-    */
-   g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                       "0:rwx"));
-+                      PERMISSION_ITEM (PW_ID_CORE, PW_PERM_RWX));
- 
-   /*
-    * PipeWire:Interface:NodeFactory
-    * Needs r-- so it can be passed to create-object when creating the sink node.
-    */
--  node_factory_permission_string = g_strdup_printf ("%d:r--",
--                                                    remote->node_factory_id);
--  string_stash = g_list_prepend (string_stash, node_factory_permission_string);
-   g_array_append_val (permission_items,
--                      PERMISSION_ITEM (PW_CORE_PROXY_PERMISSIONS_GLOBAL,
--                                       node_factory_permission_string));
--  node_global = g_hash_table_lookup (remote->globals,
--                                     GINT_TO_POINTER (remote->node_factory_id));
--  append_parent_permissions (remote, permission_items, &string_stash,
--                             node_global, "r--");
-+                      PERMISSION_ITEM (remote->node_factory_id, PW_PERM_R));
- 
--  append_stream_permissions (remote, permission_items, &string_stash, streams);
-+  append_stream_permissions (remote, permission_items, streams);
- 
--  permission_dict =
--    &SPA_DICT_INIT ((struct spa_dict_item *) permission_items->data,
--                    permission_items->len);
--  pw_core_proxy_permissions (pw_remote_get_core_proxy (remote->remote),
--                             permission_dict);
-+  /*
-+   * Hide all existing and future nodes (except the ones we explicitly list above).
-+   */
-+  g_array_append_val (permission_items,
-+                      PERMISSION_ITEM (PW_ID_ANY, 0));
- 
--  g_list_free_full (string_stash, g_free);
-+  pw_client_update_permissions (pw_core_get_client(remote->core),
-+                                permission_items->len,
-+                                (const struct pw_permission *)permission_items->data);
- 
-   pipewire_remote_roundtrip (remote);
- 
-@@ -943,7 +879,7 @@ handle_open_pipewire_remote (XdpScreenCast *object,
-     }
- 
-   out_fd_list = g_unix_fd_list_new ();
--  fd = pw_remote_steal_fd (remote->remote);
-+  fd = pw_core_steal_fd (remote->core);
-   fd_id = g_unix_fd_list_append (out_fd_list, fd, &error);
-   close (fd);
-   pipewire_remote_destroy (remote);
diff --git a/srcpkgs/xdg-desktop-portal/template b/srcpkgs/xdg-desktop-portal/template
index 1136b6a6e0e..8a39a1afb06 100644
--- a/srcpkgs/xdg-desktop-portal/template
+++ b/srcpkgs/xdg-desktop-portal/template
@@ -1,22 +1,27 @@
 # Template file for 'xdg-desktop-portal'
 pkgname=xdg-desktop-portal
-version=1.6.0
-revision=2
+version=1.8.0
+revision=1
 build_style=gnu-configure
-configure_args="--enable-pipewire --enable-geoclue --disable-libportal"
-hostmakedepends="automake libtool gettext-devel pkg-config glib-devel"
-makedepends="flatpak-devel fuse-devel pipewire-devel geoclue2-devel"
+#make_check_target="check"
+configure_args="--enable-pipewire --enable-geoclue --enable-libportal"
+hostmakedepends="pkg-config glib-devel"
+makedepends="flatpak-devel fuse-devel pipewire-devel geoclue2-devel
+ libportal-devel"
+checkdepends="dbus"
 short_desc="Portal frontend service for Flatpak"
 maintainer="Duncaen <duncaen@voidlinux.org>"
 license="LGPL-2.1-or-later"
 homepage="https://github.com/flatpak/xdg-desktop-portal"
 distfiles="https://github.com/flatpak/${pkgname}/releases/download/${version}/${pkgname}-${version}.tar.xz"
-checksum=883c9c9a925e48af54812b5347f546dd776ec2e27076a83d5a8126af6bafb9da
+checksum=a2fc5681b3a35078239072a98d6435a4c8404016730cab17c9febfd4ecec3610
 
-pre_configure() {
-	autoreconf -vfi
+# ERROR: test-portals - Bail out! xdg-desktop-portal:ERROR:tests/test-portals.c:156:global_setup: assertion failed (error == NULL): The connection is closed (g-io-error-quark, 18)
+# ERROR: test-permission-store - Bail out! xdg-desktop-portal:ERROR:tests/test-permission-store.c:472:global_setup: assertion failed (error == NULL): The connection is closed (g-io-error-quark, 18)
+do_check() {
+	make check || :
 }
 
 post_install() {
-	rm -rf "${DESTDIR}/usr/lib/systemd"
+	rm -fR "${DESTDIR}/usr/lib/systemd"
 }

From b190ae244d574553767ed6b5097bf2b3b512d43b Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Mon, 16 Nov 2020 00:59:09 +0300
Subject: [PATCH 2/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 08744e7e6603e14e3e1c40ee98a499466643c20e Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Wed, 4 Nov 2020 02:42:23 +0300
Subject: [PATCH 3/4] New package: libpipewire0.2

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

From 762ac69477e247f37519afd63ccbf710731307dc 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 | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index e9db11e215c..ad83990decd 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,8 @@ 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 libpipewire0.2-devel
+ python-setuptools xcb-proto
  $(vopt_if sndio sndio-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
@@ -42,7 +44,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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (19 preceding siblings ...)
  2020-11-19 21:54 ` Logarithmus
@ 2020-11-20  1:02 ` Logarithmus
  2020-11-20 21:26 ` Logarithmus
                   ` (30 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-20  1:02 UTC (permalink / raw)
  To: ml

[-- 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`
    - [ ] x86_64-musl - works for Chromium 86: https://youtu.be/HnD5mgPn8gk
    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: 9824 bytes --]

From bf71c15f98cb4aa9ff88471e465fbd01c8348988 Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Mon, 16 Nov 2020 00:59:09 +0300
Subject: [PATCH 1/3] 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 af0e2bb693448d4793ced70ec04f4c55edcd9f7e Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Wed, 4 Nov 2020 02:42:23 +0300
Subject: [PATCH 2/3] New package: libpipewire0.2

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

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

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

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index e9db11e215c..ad83990decd 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,8 @@ 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 libpipewire0.2-devel
+ python-setuptools xcb-proto
  $(vopt_if sndio sndio-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
@@ -42,7 +44,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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (20 preceding siblings ...)
  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
                   ` (29 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-20 21:26 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731415225

Comment:
I hope this PR will ever be merged... I've spent so much time on it.
Enabling this compile option shouldn't be a problem, because there's a flag in `chromium://flags` to toggle PipeWire support.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (21 preceding siblings ...)
  2020-11-20 21:26 ` Logarithmus
@ 2020-11-21  0:59 ` Logarithmus
  2020-11-21  1:00 ` Logarithmus
                   ` (28 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  0:59 UTC (permalink / raw)
  To: ml

[-- 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: 10564 bytes --]

From f96e9a249b4cfdc82f82a9c360739f53be44d5aa Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Mon, 16 Nov 2020 00:59:09 +0300
Subject: [PATCH 1/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 5b5b13afaa42d467851edf10a44dbd82768b69da 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 308e4589d716ff5672c1bef7ee990c70a3b1be20 Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Wed, 4 Nov 2020 02:42:23 +0300
Subject: [PATCH 3/4] New package: libpipewire0.2

---
 srcpkgs/libpipewire0.2-devel    |  1 +
 srcpkgs/libpipewire0.2/template | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 42 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..9891b55f156
--- /dev/null
+++ b/srcpkgs/libpipewire0.2/template
@@ -0,0 +1,41 @@
+# 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
+#conf_files="/etc/pipewire/pipewire.conf"
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+	LDFLAGS+=" -latomic"
+fi
+
+post_install() {
+	rm -r ${DESTDIR}/{etc,usr/bin}
+	mv ${DESTDIR}/usr/include/pipewire ${DESTDIR}/usr/include/pipewire-0.2
+	mv ${DESTDIR}/usr/include/spa ${DESTDIR}/usr/include/spa-0.1
+	vlicense LICENSE
+}
+
+libpipewire0.2-devel_package() {
+	depends="${pkgname}-${version}_${revision}"
+	short_desc+=" - pipewire and libspa development files"
+	pkg_install() {
+		vmove usr/include/pipewire-0.2
+		vmove usr/include/spa-0.1
+		vmove usr/lib/pkgconfig/libpipewire-0.2.pc
+		vmove usr/lib/pkgconfig/libspa-0.1.pc
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

From 32484e9e00ccdabddc756d7d2aed8e57e5f8a78f 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 | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index b31a09ed1f6..26fec70ff78 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,8 @@ 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 libpipewire0.2-devel
+ python-setuptools xcb-proto
  $(vopt_if sndio sndio-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
@@ -42,7 +44,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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (22 preceding siblings ...)
  2020-11-21  0:59 ` [PR PATCH] [Updated] " Logarithmus
@ 2020-11-21  1:00 ` Logarithmus
  2020-11-21  1:03 ` ericonr
                   ` (27 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  1:00 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731479841

Comment:
@ifreund that's because for some strange reason `chromium` package doesn't depend on `libpipewire0.2-devel`, even though I've added it into the template's `makedepends` section. I had to build and install it manually. Possibly It's mandatory to add `libpipewire0.2` into `common/shlibs`. Anyway, I've just added it and 'll re-package with this change and see where it goes. 

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (23 preceding siblings ...)
  2020-11-21  1:00 ` Logarithmus
@ 2020-11-21  1:03 ` ericonr
  2020-11-21  1:15 ` [PR PATCH] [Updated] " Logarithmus
                   ` (26 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: ericonr @ 2020-11-21  1:03 UTC (permalink / raw)
  To: ml

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

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731480436

Comment:
> Possibly It's mandatory to add libpipewire0.2 into common/shlibs

You may need to do this if you want the package to detect the `libpipewire` dependency, but it shouldn't make any difference for the header to be found.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (24 preceding siblings ...)
  2020-11-21  1:03 ` ericonr
@ 2020-11-21  1:15 ` Logarithmus
  2020-11-21  1:35 ` Logarithmus
                   ` (25 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  1:15 UTC (permalink / raw)
  To: ml

[-- 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: 10292 bytes --]

From f96e9a249b4cfdc82f82a9c360739f53be44d5aa Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Mon, 16 Nov 2020 00:59:09 +0300
Subject: [PATCH 1/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 5b5b13afaa42d467851edf10a44dbd82768b69da 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 082372da95e3baf39f1b01e19b6a8aeb025d9e0d Mon Sep 17 00:00:00 2001
From: Artur Sinila <opensource@logarithmus.dev>
Date: Wed, 4 Nov 2020 02:42:23 +0300
Subject: [PATCH 3/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..ee0dce2ca67
--- /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/pipewire
+		vmove usr/lib/pkgconfig
+		vmove usr/lib/libpipewire-0.2.so
+	}
+}

From df81cf4f49909461837416eba24965871f363072 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 | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index b31a09ed1f6..26fec70ff78 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,8 @@ 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 libpipewire0.2-devel
+ python-setuptools xcb-proto
  $(vopt_if sndio sndio-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
@@ -42,7 +44,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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (25 preceding siblings ...)
  2020-11-21  1:15 ` [PR PATCH] [Updated] " Logarithmus
@ 2020-11-21  1:35 ` Logarithmus
  2020-11-21  1:46 ` Logarithmus
                   ` (24 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  1:35 UTC (permalink / raw)
  To: ml

[-- 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: 10181 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 72f4e7f4951f71e27dd3a8ce5063f08f940d4b2c 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 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index b31a09ed1f6..ae1b2c2dccb 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)"
@@ -35,6 +36,7 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
+ $(vopt_if pipewire libpipewire0.2-devel)
  $(vopt_if sndio sndio-devel)"
 depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
 
@@ -42,7 +44,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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (26 preceding siblings ...)
  2020-11-21  1:35 ` Logarithmus
@ 2020-11-21  1:46 ` Logarithmus
  2020-11-21  1:53 ` Logarithmus
                   ` (23 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  1:46 UTC (permalink / raw)
  To: ml

[-- 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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (27 preceding siblings ...)
  2020-11-21  1:46 ` Logarithmus
@ 2020-11-21  1:53 ` Logarithmus
  2020-11-21  1:54 ` Logarithmus
                   ` (22 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  1:53 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731488564

Comment:
@ifreund OK, I've fixed `libpipewire0.2`'s template, now headers should be visible.
@ericonr I've added `libpipewire0.2` into `common/shlibs`. Unfortunately, `chromium` still doesn't depend on `libpipewire0.2`. That's because `chromium`'s binary dlopens `libpipewire`, and libpipewire is missing in `ldd /lib/chromium/chromium`

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (28 preceding siblings ...)
  2020-11-21  1:53 ` Logarithmus
@ 2020-11-21  1:54 ` Logarithmus
  2020-11-21  1:54 ` Logarithmus
                   ` (21 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  1:54 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731488564

Comment:
@ifreund OK, I've fixed `libpipewire0.2`'s template, now headers should be visible. They were fixed on my VPS and laptop, but not on GitHub.
@ericonr I've added `libpipewire0.2` into `common/shlibs`. Unfortunately, `chromium` still doesn't depend on `libpipewire0.2`. That's because `chromium`'s binary dlopens `libpipewire`, and libpipewire is missing in `ldd /lib/chromium/chromium`

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (29 preceding siblings ...)
  2020-11-21  1:54 ` Logarithmus
@ 2020-11-21  1:54 ` Logarithmus
  2020-11-21  1:57 ` Logarithmus
                   ` (20 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  1:54 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731488564

Comment:
@ifreund OK, I've fixed `libpipewire0.2`'s template, now headers should be visible. It was correct on my VPS and laptop, but not on GitHub.
@ericonr I've added `libpipewire0.2` into `common/shlibs`. Unfortunately, `chromium` still doesn't depend on `libpipewire0.2`. That's because `chromium`'s binary dlopens `libpipewire`, and libpipewire is missing in `ldd /lib/chromium/chromium`

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (30 preceding siblings ...)
  2020-11-21  1:54 ` Logarithmus
@ 2020-11-21  1:57 ` Logarithmus
  2020-11-21  1:57 ` Logarithmus
                   ` (19 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  1:57 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731488564

Comment:
@ifreund OK, I've fixed `libpipewire0.2`'s template, now headers should be visible. It was correct on my VPS and laptop, but not on GitHub.
@ericonr I've added `libpipewire0.2` into `common/shlibs`. Unfortunately, `chromium` still doesn't depend on `libpipewire0.2`. That's because `chromium`'s binary dlopens `libpipewire`, and libpipewire is missing in `ldd /lib/chromium/chromium`.
IMHO that's a bug in `xbps`. If this is intended behavior, then we should add notice about that to https://docs.voidlinux.org

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (31 preceding siblings ...)
  2020-11-21  1:57 ` Logarithmus
@ 2020-11-21  1:57 ` Logarithmus
  2020-11-21  1:57 ` Logarithmus
                   ` (18 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  1:57 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731488564

Comment:
@ifreund OK, I've fixed `libpipewire0.2`'s template, now headers should be visible. It was correct on my VPS and laptop, but not on GitHub.
@ericonr I've added `libpipewire0.2` into `common/shlibs`. Unfortunately, `chromium` still doesn't depend on `libpipewire0.2`. That's because `chromium`'s binary dlopens `libpipewire`, and libpipewire is missing in `ldd /lib/chromium/chromium`.
IMHO that's a bug in `xbps`. If this is intended behavior, then we should probably add notice about that to https://docs.voidlinux.org

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (32 preceding siblings ...)
  2020-11-21  1:57 ` Logarithmus
@ 2020-11-21  1:57 ` Logarithmus
  2020-11-21  1:59 ` Logarithmus
                   ` (17 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  1:57 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731488564

Comment:
@ifreund OK, I've fixed `libpipewire0.2`'s template, now headers should be visible. It was correct on my VPS and laptop, but not on GitHub.
@ericonr I've added `libpipewire0.2` into `common/shlibs`. Unfortunately, `chromium` still doesn't depend on `libpipewire0.2`. That's because `chromium`'s binary dlopens `libpipewire`, and libpipewire is missing in `ldd /lib/chromium/chromium`.
IMHO that's a bug in `xbps`. If this is intended behavior, then we should probably add notice about it to https://docs.voidlinux.org

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (33 preceding siblings ...)
  2020-11-21  1:57 ` Logarithmus
@ 2020-11-21  1:59 ` Logarithmus
  2020-11-21  2:00 ` ericonr
                   ` (16 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  1:59 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731488564

Comment:
@ifreund OK, I've fixed `libpipewire0.2`'s template, now headers should be visible. It was correct on my VPS and laptop, but not on GitHub.
@ericonr I've added `libpipewire0.2` into `common/shlibs`. Unfortunately, `chromium` still doesn't depend on `libpipewire0.2`. That's because `chromium`'s binary dlopens `libpipewire`, and thus libpipewire is missing in `ldd /lib/chromium/chromium`.
IMHO that's a bug in `xbps`. If this is intended behavior, then we should probably add notice about it to https://docs.voidlinux.org

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (34 preceding siblings ...)
  2020-11-21  1:59 ` Logarithmus
@ 2020-11-21  2:00 ` ericonr
  2020-11-21  2:08 ` Logarithmus
                   ` (15 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: ericonr @ 2020-11-21  2:00 UTC (permalink / raw)
  To: ml

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

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731489500

Comment:
> That's because chromium's binary dlopens libpipewire, and libpipewire is missing in ldd /lib/chromium/chromium.
IMHO that's a bug in xbps.

That's all working as intended. Applications use `dlopen` exactly to allow for optional dependencies, and scanning a binary for what it does open will 1) be fragile and 2) remove the usefulness of dlopening in the first place.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (35 preceding siblings ...)
  2020-11-21  2:00 ` ericonr
@ 2020-11-21  2:08 ` Logarithmus
  2020-11-21  2:08 ` Logarithmus
                   ` (14 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  2:08 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731490664

Comment:
> > That's because chromium's binary dlopens libpipewire, and libpipewire is missing in ldd /lib/chromium/chromium.
> > IMHO that's a bug in xbps.
> 
> That's all working as intended. Applications use `dlopen` exactly to allow for optional dependencies, and scanning a binary for what it does open will 1) be fragile and 2) remove the usefulness of dlopening in the first place.

OK, if I'll explicitly include `libpipewire0.2` into `depends` section, in addition to `makedepends`, will it finally work? 
IMHO the right solution to such problems is the support of optional dependencies `xbps`, like `pacman` does.
There's an issue about that https://github.com/void-linux/xbps/issues/1, but unfortunately `xbps` isn't actively developed anymore (I guess that's related to Juan RP's departure).

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (36 preceding siblings ...)
  2020-11-21  2:08 ` Logarithmus
@ 2020-11-21  2:08 ` Logarithmus
  2020-11-21  2:08 ` Logarithmus
                   ` (13 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  2:08 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731490664

Comment:
> > That's because chromium's binary dlopens libpipewire, and libpipewire is missing in ldd /lib/chromium/chromium.
> > IMHO that's a bug in xbps.
> 
> That's all working as intended. Applications use `dlopen` exactly to allow for optional dependencies, and scanning a binary for what it does open will 1) be fragile and 2) remove the usefulness of dlopening in the first place.

OK, if I'll explicitly include `libpipewire0.2` into `depends` section, in addition to `makedepends`, will it finally work? 
IMHO the right solution to such problems is the support for optional dependencies `xbps`, like `pacman` does.
There's an issue about that https://github.com/void-linux/xbps/issues/1, but unfortunately `xbps` isn't actively developed anymore (I guess that's related to Juan RP's departure).

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (37 preceding siblings ...)
  2020-11-21  2:08 ` Logarithmus
@ 2020-11-21  2:08 ` Logarithmus
  2020-11-21  2:10 ` Logarithmus
                   ` (12 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  2:08 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731490664

Comment:
> > That's because chromium's binary dlopens libpipewire, and libpipewire is missing in ldd /lib/chromium/chromium.
> > IMHO that's a bug in xbps.
> 
> That's all working as intended. Applications use `dlopen` exactly to allow for optional dependencies, and scanning a binary for what it does open will 1) be fragile and 2) remove the usefulness of dlopening in the first place.

OK, if I'll explicitly include `libpipewire0.2` into `depends` section, in addition to `makedepends`, will it finally work? 
IMHO the right solution to such problems is to implement the support for optional dependencies in `xbps`, like `pacman` does.
There's an issue about that https://github.com/void-linux/xbps/issues/1, but unfortunately `xbps` isn't actively developed anymore (I guess that's related to Juan RP's departure).

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (38 preceding siblings ...)
  2020-11-21  2:08 ` Logarithmus
@ 2020-11-21  2:10 ` Logarithmus
  2020-11-21  2:28 ` [PR PATCH] [Updated] " Logarithmus
                   ` (11 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  2:10 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731490664

Comment:
> > That's because chromium's binary dlopens libpipewire, and libpipewire is missing in ldd /lib/chromium/chromium.
> > IMHO that's a bug in xbps.
> 
> That's all working as intended. Applications use `dlopen` exactly to allow for optional dependencies, and scanning a binary for what it does open will 1) be fragile and 2) remove the usefulness of dlopening in the first place.

OK, if I'll explicitly include `libpipewire0.2` into `depends` section, in addition to `makedepends`, will it finally work? 
IMHO the right solution to such problems is to implement the support for optional dependencies in `xbps`, like `pacman` does.
There's an issue about that https://github.com/void-linux/xbps/issues/1, but unfortunately `xbps` isn't actively developed anymore (I guess that's related to Juan RP's departure).
**UPD** just seen your fairly recent PRs in `xbps` repo, OK, I was wrong about non-active development.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [PR PATCH] [Updated] chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (39 preceding siblings ...)
  2020-11-21  2:10 ` Logarithmus
@ 2020-11-21  2:28 ` Logarithmus
  2020-11-21  2:29 ` Logarithmus
                   ` (10 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  2:28 UTC (permalink / raw)
  To: ml

[-- 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: 10256 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 e153d1fac1aaaeebe62c16e8c2b734c8f641f36b 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 | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index b31a09ed1f6..54b3b6d6311 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)"
@@ -35,14 +36,15 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-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
+ $(vopt_if pipewire libpipewire0.2-devel)
  $(vopt_if sndio sndio-devel)"
-depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils"
+depends="libexif hwids desktop-file-utils hicolor-icon-theme xdg-utils libpipewire0.2"
 
 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 +198,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

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (40 preceding siblings ...)
  2020-11-21  2:28 ` [PR PATCH] [Updated] " Logarithmus
@ 2020-11-21  2:29 ` Logarithmus
  2020-11-21 11:17 ` ifreund
                   ` (9 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21  2:29 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731490664

Comment:
> > That's because chromium's binary dlopens libpipewire, and libpipewire is missing in ldd /lib/chromium/chromium.
> > IMHO that's a bug in xbps.
> 
> That's all working as intended. Applications use `dlopen` exactly to allow for optional dependencies, and scanning a binary for what it does open will 1) be fragile and 2) remove the usefulness of dlopening in the first place.

OK, if I'll explicitly include `libpipewire0.2` into `depends` section, in addition to `makedepends`, will it finally work? 
IMHO the right solution to such problems is to implement the support for optional dependencies in `xbps`, like `pacman` does.
There's an issue about that https://github.com/void-linux/xbps/issues/1, but unfortunately `xbps` isn't actively developed anymore (I guess that's related to Juan RP's departure).
**UPD**: Just seen your fairly recent PRs in `xbps` repo, OK, I was wrong about non-active development.
**UPD 2**: Seems that including `libpipewire0.2` into `depends` section finally solve the issue! Pushed it

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (41 preceding siblings ...)
  2020-11-21  2:29 ` Logarithmus
@ 2020-11-21 11:17 ` ifreund
  2020-11-21 11:44 ` Logarithmus
                   ` (8 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: ifreund @ 2020-11-21 11:17 UTC (permalink / raw)
  To: ml

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

New comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731564942

Comment:
I still get the same error with the latest commit. I also don't see the include dir for pipewire in the clang++ command line flags, so it seems like pipewire's pkgconfig is not getting used for whatever reason.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (42 preceding siblings ...)
  2020-11-21 11:17 ` ifreund
@ 2020-11-21 11:44 ` Logarithmus
  2020-11-21 11:44 ` Logarithmus
                   ` (7 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21 11:44 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731567846

Comment:
@ifreund can I ask you to check if `/usr/include/pipewire` directory presents in `libpipewire0.2-devel` package? If it's called `pipewire-0.2` instead, then please rebuild the package.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (43 preceding siblings ...)
  2020-11-21 11:44 ` Logarithmus
@ 2020-11-21 11:44 ` Logarithmus
  2020-11-21 12:33 ` ifreund
                   ` (6 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21 11:44 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731567865

Comment:
@ifreund can I ask you to check if `/usr/include/pipewire` directory presents in `libpipewire0.2-devel` package? If it's called `pipewire-0.2` instead, then please rebuild the package.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (44 preceding siblings ...)
  2020-11-21 11:44 ` Logarithmus
@ 2020-11-21 12:33 ` ifreund
  2020-11-21 12:34 ` ifreund
                   ` (5 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: ifreund @ 2020-11-21 12:33 UTC (permalink / raw)
  To: ml

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

New comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731573059

Comment:


<details>
<summary>
```
$ xls libpipewire0.2-devel
```
```
/usr/include/pipewire/array.h
/usr/include/pipewire/client.h
/usr/include/pipewire/command.h
/usr/include/pipewire/control.h
/usr/include/pipewire/core.h
/usr/include/pipewire/data-loop.h
/usr/include/pipewire/extensions/client-node.h
/usr/include/pipewire/extensions/protocol-native.h
/usr/include/pipewire/factory.h
/usr/include/pipewire/global.h
/usr/include/pipewire/interfaces.h
/usr/include/pipewire/introspect.h
/usr/include/pipewire/link.h
/usr/include/pipewire/log.h
/usr/include/pipewire/loop.h
/usr/include/pipewire/main-loop.h
/usr/include/pipewire/map.h
/usr/include/pipewire/mem.h
/usr/include/pipewire/module.h
/usr/include/pipewire/node.h
/usr/include/pipewire/pipewire.h
/usr/include/pipewire/port.h
/usr/include/pipewire/properties.h
/usr/include/pipewire/protocol.h
/usr/include/pipewire/proxy.h
/usr/include/pipewire/remote.h
/usr/include/pipewire/resource.h
/usr/include/pipewire/stream.h
/usr/include/pipewire/thread-loop.h
/usr/include/pipewire/type.h
/usr/include/pipewire/utils.h
/usr/include/pipewire/version.h
/usr/include/pipewire/work-queue.h
/usr/include/spa/buffer/buffer.h
/usr/include/spa/buffer/meta.h
/usr/include/spa/clock/clock.h
/usr/include/spa/graph/graph.h
/usr/include/spa/monitor/monitor.h
/usr/include/spa/node/command.h
/usr/include/spa/node/event.h
/usr/include/spa/node/io.h
/usr/include/spa/node/node.h
/usr/include/spa/param/audio/format-utils.h
/usr/include/spa/param/audio/format.h
/usr/include/spa/param/audio/raw-utils.h
/usr/include/spa/param/audio/raw.h
/usr/include/spa/param/buffers.h
/usr/include/spa/param/format-utils.h
/usr/include/spa/param/format.h
/usr/include/spa/param/io.h
/usr/include/spa/param/meta.h
/usr/include/spa/param/param.h
/usr/include/spa/param/props.h
/usr/include/spa/param/video/chroma.h
/usr/include/spa/param/video/color.h
/usr/include/spa/param/video/encoded.h
/usr/include/spa/param/video/format-utils.h
/usr/include/spa/param/video/format.h
/usr/include/spa/param/video/multiview.h
/usr/include/spa/param/video/raw-utils.h
/usr/include/spa/param/video/raw.h
/usr/include/spa/pod/builder.h
/usr/include/spa/pod/command.h
/usr/include/spa/pod/event.h
/usr/include/spa/pod/iter.h
/usr/include/spa/pod/parser.h
/usr/include/spa/pod/pod.h
/usr/include/spa/support/log-impl.h
/usr/include/spa/support/log.h
/usr/include/spa/support/loop.h
/usr/include/spa/support/plugin.h
/usr/include/spa/support/type-map-impl.h
/usr/include/spa/support/type-map.h
/usr/include/spa/utils/defs.h
/usr/include/spa/utils/dict.h
/usr/include/spa/utils/hook.h
/usr/include/spa/utils/list.h
/usr/include/spa/utils/ringbuffer.h
/usr/include/spa/utils/type.h
/usr/lib/pkgconfig/libpipewire-0.2.pc
/usr/lib/pkgconfig/libspa-0.1.pc
/usr/lib/libpipewire-0.2.so -> /usr/lib/libpipewire-0.2.so.1
```

</details>

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (45 preceding siblings ...)
  2020-11-21 12:33 ` ifreund
@ 2020-11-21 12:34 ` ifreund
  2020-11-21 13:21 ` Logarithmus
                   ` (4 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: ifreund @ 2020-11-21 12:34 UTC (permalink / raw)
  To: ml

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

New comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731573059

Comment:
Looks like it's there, still get the same error building chromium though.
<details>
<summary>

```
$ xls libpipewire0.2-devel
```

</summary>

```
/usr/include/pipewire/array.h
/usr/include/pipewire/client.h
/usr/include/pipewire/command.h
/usr/include/pipewire/control.h
/usr/include/pipewire/core.h
/usr/include/pipewire/data-loop.h
/usr/include/pipewire/extensions/client-node.h
/usr/include/pipewire/extensions/protocol-native.h
/usr/include/pipewire/factory.h
/usr/include/pipewire/global.h
/usr/include/pipewire/interfaces.h
/usr/include/pipewire/introspect.h
/usr/include/pipewire/link.h
/usr/include/pipewire/log.h
/usr/include/pipewire/loop.h
/usr/include/pipewire/main-loop.h
/usr/include/pipewire/map.h
/usr/include/pipewire/mem.h
/usr/include/pipewire/module.h
/usr/include/pipewire/node.h
/usr/include/pipewire/pipewire.h
/usr/include/pipewire/port.h
/usr/include/pipewire/properties.h
/usr/include/pipewire/protocol.h
/usr/include/pipewire/proxy.h
/usr/include/pipewire/remote.h
/usr/include/pipewire/resource.h
/usr/include/pipewire/stream.h
/usr/include/pipewire/thread-loop.h
/usr/include/pipewire/type.h
/usr/include/pipewire/utils.h
/usr/include/pipewire/version.h
/usr/include/pipewire/work-queue.h
/usr/include/spa/buffer/buffer.h
/usr/include/spa/buffer/meta.h
/usr/include/spa/clock/clock.h
/usr/include/spa/graph/graph.h
/usr/include/spa/monitor/monitor.h
/usr/include/spa/node/command.h
/usr/include/spa/node/event.h
/usr/include/spa/node/io.h
/usr/include/spa/node/node.h
/usr/include/spa/param/audio/format-utils.h
/usr/include/spa/param/audio/format.h
/usr/include/spa/param/audio/raw-utils.h
/usr/include/spa/param/audio/raw.h
/usr/include/spa/param/buffers.h
/usr/include/spa/param/format-utils.h
/usr/include/spa/param/format.h
/usr/include/spa/param/io.h
/usr/include/spa/param/meta.h
/usr/include/spa/param/param.h
/usr/include/spa/param/props.h
/usr/include/spa/param/video/chroma.h
/usr/include/spa/param/video/color.h
/usr/include/spa/param/video/encoded.h
/usr/include/spa/param/video/format-utils.h
/usr/include/spa/param/video/format.h
/usr/include/spa/param/video/multiview.h
/usr/include/spa/param/video/raw-utils.h
/usr/include/spa/param/video/raw.h
/usr/include/spa/pod/builder.h
/usr/include/spa/pod/command.h
/usr/include/spa/pod/event.h
/usr/include/spa/pod/iter.h
/usr/include/spa/pod/parser.h
/usr/include/spa/pod/pod.h
/usr/include/spa/support/log-impl.h
/usr/include/spa/support/log.h
/usr/include/spa/support/loop.h
/usr/include/spa/support/plugin.h
/usr/include/spa/support/type-map-impl.h
/usr/include/spa/support/type-map.h
/usr/include/spa/utils/defs.h
/usr/include/spa/utils/dict.h
/usr/include/spa/utils/hook.h
/usr/include/spa/utils/list.h
/usr/include/spa/utils/ringbuffer.h
/usr/include/spa/utils/type.h
/usr/lib/pkgconfig/libpipewire-0.2.pc
/usr/lib/pkgconfig/libspa-0.1.pc
/usr/lib/libpipewire-0.2.so -> /usr/lib/libpipewire-0.2.so.1
```

</details>

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (46 preceding siblings ...)
  2020-11-21 12:34 ` ifreund
@ 2020-11-21 13:21 ` Logarithmus
  2020-11-21 13:22 ` Logarithmus
                   ` (3 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21 13:21 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731567846

Comment:
@ifreund can I ask you to check if `/usr/include/pipewire` directory presents in `libpipewire0.2-devel` package? If it's called `pipewire-0.2` instead, then please rebuild the package.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (47 preceding siblings ...)
  2020-11-21 13:21 ` Logarithmus
@ 2020-11-21 13:22 ` Logarithmus
  2020-11-21 13:23 ` Logarithmus
                   ` (2 subsequent siblings)
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21 13:22 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731578963

Comment:
> Looks like it's there, still get the same error building chromium though.
> 
> ```
> $ xls libpipewire0.2-devel
> ```

I guess you have to rerun `configure` & `build` stages in order for it to see the headers.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (48 preceding siblings ...)
  2020-11-21 13:22 ` Logarithmus
@ 2020-11-21 13:23 ` Logarithmus
  2020-11-21 19:04 ` ifreund
  2020-11-22 14:52 ` ifreund
  51 siblings, 0 replies; 53+ messages in thread
From: Logarithmus @ 2020-11-21 13:23 UTC (permalink / raw)
  To: ml

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

New comment by Logarithmus on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731578963

Comment:
> Looks like it's there, still get the same error building chromium though.
> 
> ```
> $ xls libpipewire0.2-devel
> ```

I guess you have to rerun `configure` & `build` stages for `chromium` in order for it to see the headers.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (49 preceding siblings ...)
  2020-11-21 13:23 ` Logarithmus
@ 2020-11-21 19:04 ` ifreund
  2020-11-22 14:52 ` ifreund
  51 siblings, 0 replies; 53+ messages in thread
From: ifreund @ 2020-11-21 19:04 UTC (permalink / raw)
  To: ml

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

New comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731622353

Comment:
> I guess you have to rerun `configure` & `build` stages for `chromium` in order for it to see the headers.

Looks like you were right, after a `git clean` and several hours it finished building. I should have time to get xdpw/pipewire setup and give this a test later tonight or tomorrow.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: chromium: enable WebRTC screen sharing via PipeWire
  2020-11-05  3:49 [PR PATCH] chromium: enable Logarithmus
                   ` (50 preceding siblings ...)
  2020-11-21 19:04 ` ifreund
@ 2020-11-22 14:52 ` ifreund
  51 siblings, 0 replies; 53+ messages in thread
From: ifreund @ 2020-11-22 14:52 UTC (permalink / raw)
  To: ml

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

New comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/26144#issuecomment-731759815

Comment:
Confirmed that this works with #23296 to screenshare on sway x86_64 glibc using the webrtc test page here: https://mozilla.github.io/webrtc-landing/gum_test.html

^ permalink raw reply	[flat|nested] 53+ messages in thread

end of thread, other threads:[~2020-11-22 14:52 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

Github messages for voidlinux

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/voidlinux-github

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 voidlinux-github voidlinux-github/ http://inbox.vuxu.org/voidlinux-github \
		voidlinux-github@inbox.vuxu.org
	public-inbox-index voidlinux-github

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.github.voidlinux


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git