Open Bug 1672944 (pipewire) Opened 6 months ago Updated 1 day ago

WebRTC PipeWire tracker

Categories

(Core :: WebRTC, enhancement)

enhancement

Tracking

()

People

(Reporter: stransky, Assigned: stransky)

References

(Depends on 3 open bugs)

Details

We should support Pipewire out of the box in WebRTC. When Wayland session is used (and Firefox does not need to run with Wayland backend), screen sharing is generally broken.

This involves to ship pipewire library wrapper and pipewire headers.

Depends on: 1672945
Depends on: 1672947
Depends on: 1672948

Just so you're aware, we've started working on updating the version of libwebrtc we have in tree (tracked by Bug 1654112) so there will definitely be some churn in the desktop capture code. I'm not sure if that will have a large impact on the work you're planning here.

(In reply to Dan Minor [:dminor] from comment #1)

Just so you're aware, we've started working on updating the version of libwebrtc we have in tree (tracked by Bug 1654112) so there will definitely be some churn in the desktop capture code. I'm not sure if that will have a large impact on the work you're planning here.

Dan, thanks for heads-up. I have the patches ready but it can wait until the update is finished.
Also the pipewire headers and library wrapper should be independent on it unless you also want to pull that parts.

Depends on: 1654112

I'll file the patches anyway to have it tracked somewhere. It can be then updated according to the update.

Depends on: 1672987
Depends on: 1672989

Might be worth mentioning this upstream patch that has been in the works for a while. This patch attempts to reduce the number of dialogs that occur when screensharing with pipewire. After this lands, I would expect that popular vendor patches for supporting pipewire 0.3 will be introduced as well.

https://webrtc-review.googlesource.com/c/src/+/160649/33#message-a83e8959e03a274642ca2ce1abb9ea0099f08097

Duplicate of this bug: 1430775

What's the status on this? For end users like me, do we need to manually patch in the stuff listed in bugs 1654112, 1672945, 1672947, 1672948, 1672987, and 1672989, or wait for proper upstream support with regards to webRTC over Pipewire?

Thanks!

What's the status on this?

It's still being worked on. Until it's stable and enabled if official builds, the only way to get screen sharing on Linux is to manually apply the patches.

I've heard some people using the Fedora firefox binaries, which seem to be already-patched.

Finally, on some scenarios, pushing the video onto a virtual webcam device works (if you can stream a webcam on whatever site you're using).

(In reply to Hugo Osvaldo Barrera from comment #7)

What's the status on this?

It's still being worked on. Until it's stable and enabled if official builds, the only way to get screen sharing on Linux is to manually apply the patches.

I've heard some people using the Fedora firefox binaries, which seem to be already-patched.

Finally, on some scenarios, pushing the video onto a virtual webcam device works (if you can stream a webcam on whatever site you're using).

We are trying to keep track of distro patches here...
https://github.com/emersion/xdg-desktop-portal-wlr/wiki/Screencast-Compatibility#webrtc-aka-firefoxchromium

I think you're referring to v4l2loopback as the "virtual webcam" option, in case anyone is searching for more info. OBS supports sharing video using it with a plugin called obs-v4l2sink, and on wlroots based compositors, wf-recorder has support too.

Nico, any opinions on whether we should take this before or after we do the libwebrtc update? I'm leaning towards taking it now because I know this is causing problems for people and it doesn't look like it would be too difficult to rebase later on, especially if related changes are landing upstream.

Flags: needinfo?(na-g)

dminor: +1, I am for taking it now. It may need some reformatting to meet upstream code style.

Flags: needinfo?(na-g)

Try for the latest patches: https://treeherder.mozilla.org/#/jobs?repo=try&revision=07eb1c937a3448622db0025a2a2ebe1566bdb77c
The 0.3 PW patches are heading to upstream so the affected files at https://phabricator.services.mozilla.com/D94589 can be imported from upstream then.

Depends on: 1675764
Depends on: 1675767
Depends on: 1676501
Depends on: 1676586
Depends on: 1676837
Depends on: 1678269
Depends on: 1678680

Let's tracks PW issues here.

Alias: pipewire
Summary: Support pipewire out of the box → WebRTC PipeWire tracker

I using PipeWire for camera access also in scope?

(In reply to Jan Alexander Steffens [:heftig] from comment #13)

I using PipeWire for camera access also in scope?

I'm not sure what do you mean, can you explain please?

PipeWire can provide access to cameras, which means the sandbox could be tightened as Firefox no longer needs to access V4L2 devices itself.

Some context: a camera portal was introduced in https://github.com/flatpak/xdg-desktop-portal/pull/331 but IIUC the ui is still missing: https://github.com/flatpak/xdg-desktop-portal/issues/414

I'm sure we want to use V4L2 device as we want to process whole recording on GPU (va-api encoding).

Pipewire apparently allow that - Mutter uses pipewire for screen sharing and on supported configurations (currently only intel on wayland) shares buffers via dmabuf. I'm not sure if Firefox already uses dmabuf import for that, but there is a MR for OBS studio to allow direct importing of dmabuf pipewire stream: https://github.com/obsproject/obs-studio/pull/2484

For the record, one of the main benefits of using pipewire is that multiple applications can have simultaneous access to the camera, not only one application, similar to how things used to work for audio before pulseaudio came up. Access management is AFAIK a nice by-product.

Short follow up: this apparently hasn't been implemented anywhere yet (with obs studio flatpak variant being a hot contender to start IMO), but there's a simple example script: https://gitlab.gnome.org/-/snippets/762

So I guess this is well on topic and should be considered - but maybe let some other apps make the first step :)

Depends on: 1681326
Depends on: 1693849

What are the plans for adding these WebRTC Pipewire changes to the ESR branch?

Flags: needinfo?(stransky)

(In reply to Charles Robertson from comment #20)

What are the plans for adding these WebRTC Pipewire changes to the ESR branch?

None. Will be in next ESR line which is 91.

Flags: needinfo?(stransky)
You need to log in before you can comment on or make changes to this bug.