Add PipeWire audio driver#111056
Conversation
8118fa1 to
fbef317
Compare
fbef317 to
df8faaa
Compare
|
See also #109362 which may also add PipeWire support |
018674e to
4d5ab14
Compare
|
I rebased the commits so that this PR no longer depends on #109500. |
65505a9 to
4b41930
Compare
fe2c0f9 to
f1c07ca
Compare
|
f1c07cad65925fa942086cbae37c27d858af8d90 now uses |
f1c07ca to
6286dfa
Compare
777b476 to
343a871
Compare
0ad83d7 to
2a060a2
Compare
2a060a2 to
0f7c43c
Compare
9a306e1 to
c5ddbdf
Compare
|
Tested briefly on Fedora 43 (using PipeWire as audio server with default config) and it seems to work fine. I haven't reviewed the code yet. How to validate that it's indeed using PipeWire directly and not via the pipewire-pulse plugin? What kind of benefits are expected from this new driver, aside from sidestepping pipewire-pulse on systems defaulting to PipeWire? Edit: I just read the proposal in godotengine/godot-proposals#10723. It mentions lacking audio input in ALSA, and too much latency in PulseAudio. Does this PR solve those two shortcomings? Regarding the vendored headers in The downside is that we'd have to document which files should be copied / removed when updating the library. |
|
I check if a program is using pipewire directly by doing |
If I did the profiling correctly, we can expect the new driver having much lower driver time (
That makes sense, I'll try to trim down unused headers in next push. |
3bd20d5 to
f22e4eb
Compare
16cd0c4 to
48d4c22
Compare
|
Are we ready for the next round of review? |
The PR is ready for the next round of review. Should I re-request the review, or wait for the reviewers? |
|
I think re-requesting a review would be good, I asked on RocketChat for a review and that's how the previous round happened. Calinou also said he'd review but I haven't seen him so I think you could ping him too when asking for review |
|
Hi @Calinou, can you help reviewing this PR? Thank you in advance! |
There was a problem hiding this comment.
Tested locally on Fedora 43, it mostly works as expected.
Some feedback:
- PipeWire appears to be used natively, according to the above instructions:
$ pw-dump > ~/pw-dump
$ rg -i "platformer" pw-dump
10101: "application.name": "Platformer 2D",
10168: "node.name": "Platformer 2D",
10563: "object.path": "Platformer 2D:output_0",
10565: "port.alias": "Platformer 2D:output_FL",
10648: "object.path": "Platformer 2D:output_1",
10650: "port.alias": "Platformer 2D:output_FR",-
Audio input doesn't seem to work in the Mic Record demo (nothing is recorded, and the app doesn't appear in the list of recording applications). In comparison, it works in PulseAudio (but not in ALSA).
-
PipeWire sounds noticeably quieter than PulseAudio/ALSA. I double-checked all audio drivers are at 100% for the per-app volume in the system settings.
Music from the Platformer 2D demo run through PulseAudio, ALSA, then PipeWire:
Waveform of the above audio normalized in Audacity for easier comparison (from left to right: PulseAudio, ALSA, PipeWire):
- I haven't done latency testing since I don't have the hardware for it currently, but it would be good to investigate this in the future.
Thanks for the review, the PR has been updated to 506940f with the following change:
For the volume issue across different drivers, I can't seem to reproduce the same problem. The default per-app volume can be different when switching to different driver, but the waveform magnitude looks like the same when comparing with PulseAudio(first) and PipeWire(second) at 100% volume. More testing might be needed for this part. |
Calinou
left a comment
There was a problem hiding this comment.
Audio input works on my end now. Code looks good to me.
I can still reproduce the different volume on PipeWire, but as per the above comment, it's likely system-specific. I consider this PR good on my end, but I still would like it to get testing on more configurations (especially 3.1/5.1/7.1 for people who have access to such a setup).
Note that this PR uses C++20 features (designated initializers), but we considered this to be acceptable in Wayland code as it's only compiled on Linux/*BSD. Similarly, the PipeWire audio driver is Linux/*BSD-only code.


Closes godotengine/godot-proposals#10723
This PR adds PipeWire audio driver for linuxbsd platform.
Distro support
This PR expects PipeWire version 1.0.0 or higher. Here is the non-exhaustive list of minimum Linux distribution version required for the driver to work.
libpipewire-0.3.soversionHow to test the driver
The new PipeWire audio driver does not take precedence over existing PulseAudio driver at the moment. You can change
audio/driver/driverto "PipeWire" in Project Settings, or use--audio-driver PipeWirearguments to test the driver.Vendored PipeWire headers
This PR introduces new thirdparty headers to enable PipeWire support. A brief list of added PipeWire and SPA headers as of version 1.0.0 (the list may change if we update the headers in future) is documented to give a better grasp on how these headers are included.