IceDBorn / pipewire-screenaudio

Extension to passthrough pipewire audio to WebRTC Screenshare
https://addons.mozilla.org/firefox/addon/pipewire-screenaudio/
GNU General Public License v3.0
167 stars 5 forks source link

Firefox crashes if pipewire-screenaudio is active on NixOS with Mesa GPU drivers #102

Open flippette opened 5 months ago

flippette commented 5 months ago

I've tested both Discord and the gUM Test Page, both exhibits this behavior.

I'm using Firefox v127.0.1 on NixOS 24.11 unstable.

(Edit: More system info:

I'll attach more info on request.)

IceDBorn commented 5 months ago

I have this issue too. @jim3692 does not have this bug on Arch, I'm not sure if he's on the latest stable firefox though.

IceDBorn commented 5 months ago

We need more testing from NixOS users as well as different distro users. We're not sure if this issue is NixOS specific or not.

IceDBorn commented 4 months ago

We did some debugging, and it seems like that this is a bug that occurred with Firefox 127.0 specifically on nix.

IceDBorn commented 4 months ago

[Parent 170908, IPC I/O Parent] WARNING: process 171266 exited on signal 11: file /build/firefox-128.0/ipc/chromium/src/base/process_util_posix.cc:335, this error is thrown in the shell.

jim3692 commented 4 months ago

It doesn't crash if I set the latency to 17 or more. Given that my display is 60Hz (meaning the frametime is 16.67ms), there must be a relation between those numbers.

https://github.com/IceDBorn/pipewire-screenaudio/blob/bd404d0ee4b32fb797f2dcdeee3b6e773c06455c/extension/scripts/index.js#L44-L47

EDIT: It works fine with latency 17 when I do not run firefox with nixGL. When I do use nixGL (which offers hardware codecs support for nix apps on non-nix distros, like Arch) it needs to be at least 18.

IceDBorn commented 4 months ago

@flippette Can you tinker with the latency and see if it fixes the crashes for you?

flippette commented 4 months ago

@flippette Can you tinker with the latency and see if it fixes the crashes for you?

My Nix install broke, so I'm back on Arch for the time being. I'll try doing that when I get my laptop.

jim3692 commented 4 months ago

@flippette Could you tell us what is your GPU? I am starting to suspect the AMD drivers, as Firefox isn't crashing in VirtualBox.

flippette commented 4 months ago

@flippette Could you tell us what is your GPU? I am starting to suspect the AMD drivers, as Firefox isn't crashing in VirtualBox.

I have a Radeon RX 7800 XT.

jim3692 commented 4 months ago

Thank you for your feedback. I tried to passthrough my RTX 2060 to a fresh NixOS VM. Firefox doesn't crash with nvidia either. I hate this bug.

IceDBorn commented 4 months ago

So, it's a NixOS + RADV or AMDVLK specific issue.

flippette commented 4 months ago

I am using RADV, not sure about AMDVLK.

(well, was)

IceDBorn commented 4 months ago

signal-2024-07-24-201245_002

This setup does not crash the tab. I found this by changing the injector script to connect "Noise canceling source" instead of "pipewire-screenaudio", and the stream successfully started, having audio from my microphone. Doing this resulted in the node called "Noise canceling source", which has only one capture port, getting connected to Librewolf. So, the solution would be to replicate what "Noise canceling source" does. Obviously, "pipewire-screenaudio" present on this screenshot does not transmit any sound at all as it does not have any sources available. I transformed "pipewire-screenaudio" to a node with only one capture port, by changing "Audio/Source/Virtual" to "Audio/Source". The pipewire config for spawning Noise canceling source is available here.

jim3692 commented 4 months ago

Hello all,

I got it crashing on my older PCs with NixOS Unstable:

IceDBorn commented 4 months ago

We have to try using NVK instead of the proprietary drivers and see if it crashes for nvidia too @jim3692.

jim3692 commented 4 months ago

We have to try using NVK instead of the proprietary drivers and see if it crashes for nvidia too @jim3692.

Firefox is also crashing with my RTX 2060 with the NVK driver, even though Firefox is not reporting hardware decoding in the about:support page

EDIT: Disclaimer I don't have any other GPUs to test on 😅

IceDBorn commented 3 months ago

@flippette it works for me now on the latest unstable, can you confirm?

flippette commented 3 months ago

I'm still on Arch for the time being, so I can't say. Sorry 😅

IceDBorn commented 3 months ago

@flippette you betrayed the nix cult...

DADA30000 commented 1 month ago

there is also an active firefox issue specific to nix, using firefox-bin fixes discord tab crashing, but idk how to use pipewire-screenaudio with firefox-bin

IceDBorn commented 1 month ago

I haven't tested, but, wouldn't installing the firefox package as shown at the example work?

DADA30000 commented 1 month ago

I haven't tested, but, wouldn't installing the firefox package as shown at the example work?

nope, doesn't work like that with firefox-bin unfortunately, just says "native connector is misconfigured"

IceDBorn commented 3 weeks ago

@DADA30000 Does it still crash for you? Because I'm pretty sure that it does not for me. I'll try re-testing tomorrow.

DADA30000 commented 3 weeks ago

@DADA30000 Does it still crash for you? Because I'm pretty sure that it does not for me. I'll try re-testing tomorrow.

Just updated my flake, rebuilded my system, it still does, it crashes only when you're in a call with someone, and that someone says something, or when you go into voice settings in discord, and do a microphone check

IceDBorn commented 3 weeks ago

@DADA30000 I'll test it out too then.

DADA30000 commented 2 weeks ago

@DADA30000 I'll test it out too then.

could you maybe do something so that it would work with bin version? Because I think that this issue with firefox on NixOS will take a lot of time to be fixed :D

IceDBorn commented 2 weeks ago

I'm not aware of the steps needed to get it working with the bin package. Maybe you could follow the install instructions for a normal FHS distro. Ex. add the manifest.json on ~/.mozilla/native-messaging-hosts. https://github.com/IceDBorn/pipewire-screenaudio/blob/main/install.sh. You'll just have to change the path of pipewire-screenaudio to the nix store one.

DADA30000 commented 2 weeks ago

I'm not aware of the steps needed to get it working with the bin package. Maybe you could follow the install instructions for a normal FHS distro. Ex. add the manifest.json on ~/.mozilla/native-messaging-hosts. https://github.com/IceDBorn/pipewire-screenaudio/blob/main/install.sh. You'll just have to change the path of pipewire-screenaudio to the nix store one.

hmm, ok, I will try that, thanks!

DADA30000 commented 2 weeks ago

I'm not aware of the steps needed to get it working with the bin package. Maybe you could follow the install instructions for a normal FHS distro. Ex. add the manifest.json on ~/.mozilla/native-messaging-hosts. https://github.com/IceDBorn/pipewire-screenaudio/blob/main/install.sh. You'll just have to change the path of pipewire-screenaudio to the nix store one.

that worked! Idk how I haven't thought of that, thanks again!

IceDBorn commented 2 weeks ago

So, issue's fixed using the bin I guess. We just have to add a home manager module.

DADA30000 commented 2 weeks ago

So, issue's fixed using the bin I guess. We just have to add a home manager module.

oh wait, there is another problem, the only option that I can select in audio sources are virtual surround sink (it's not my main output) and audio from various tabs with audio playing

DADA30000 commented 2 weeks ago

hmm, I will check non-bin version

DADA30000 commented 2 weeks ago

Oh, sorry. it's the same on non-bin version, unrelated to this issue

DADA30000 commented 2 weeks ago

@IceDBorn you know how to fix a problem where 'All Desktop Audio" is not listed?

IceDBorn commented 2 weeks ago

All desktop audio is currently broken. Will have to push a fix.

DADA30000 commented 2 weeks ago

All desktop audio is currently broken. Will have to push a fix.

oh, ok :(