Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pipewire troubleshooting notes #2236

Closed
The-personified-devil opened this issue Jul 7, 2024 · 10 comments
Closed

Add pipewire troubleshooting notes #2236

The-personified-devil opened this issue Jul 7, 2024 · 10 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@The-personified-devil
Copy link
Collaborator

Issue because blocked on #2233, but we should mention that
A) Pipewire error: Creation failed likely means pipewire isn't setup as the audio server and
B) no audio but no error means that the device just wasn't selected in the audio settings (potentially only as a stopgap for a default button, but idk if that's feasible and configuring the audio device is an operation that imo is kinda to be expected as a user, but if you didn't think of it the troubleshooting page could just give you a heads up)

@The-personified-devil The-personified-devil moved this to Todo in Roadmap Jul 7, 2024
@The-personified-devil The-personified-devil added documentation Improvements or additions to documentation enhancement New feature or request labels Jul 7, 2024
@Meister1593
Copy link
Collaborator

For default audio we probably can use wireplumber, though some setups use pipewire-media-session instead (not sure how to handle that)

@The-personified-devil
Copy link
Collaborator Author

From what I can tell session managers also only set pipewire properties and other applications like easyeffects manage to place themselves as the default sink with just pw, so it should be possible in just pipewire and we should definitely look into that then

@Meister1593
Copy link
Collaborator

Good news: i found where are default configured audio devices are.
It's found on one of the PipeWire:Interface:Metadata under metadata sections as default.configured.audio.sink, default.configured.audio.source
Bad news: to get that without wireplumber, we literally have to do it all manually, and wireplumber is doing exactly the same thing
IMO we should look into using wireplumber instead, it seems like double work to do the same thing. Maybe note users that they should probably switch to wireplumber (unless user has specific scripts on pipewire-media-session, wireplumber is a drop in replacement)

Otherwise it looks like a huge chunk of pretty unreadable code to parse bunch of properties just to get default device, and then set it through pipewire context. Most likely even more than current code for pipewire.

@The-personified-devil
Copy link
Collaborator Author

Or rather it seems that wireplumber sets the default device based on information inside of pipewire. The priority.session key is also what you would use with wireplumber to configure priorities. So we could try using that. The second option would be to get the default device and move all their streams to us, that's how easyeffects does it, but I don't think that's a good idea.

@The-personified-devil
Copy link
Collaborator Author

Update: I tested that key and it seems to only work if you haven't manually set a default device and pipewire is just figuring it out automatically. Now it would be epic if users had clearly defined priorities so that they just need to connect devices and it automatically picks the right one, but that isn't the case and people set default devices, so this won't work. Bummer.

@The-personified-devil
Copy link
Collaborator Author

The-personified-devil commented Jul 8, 2024

I have two proposals instead:
A) We use wireplumber and make it soft-fail to a notice that the user has to set the default device themselves
or
B) Check if no streams are connected to us and warn the user that they might have to set alvr as default if they haven't already

also if we do something to set defaults, it should be done every time the device appears to ensure reliability, so a toggle to the audio settings to set the device as default automatically

@eteq eteq mentioned this issue Jul 31, 2024
5 tasks
@fpemud
Copy link

fpemud commented Aug 14, 2024

Wireplumber includes some lua scripts that can automatically modify sound route / default sink as needed. For example, when a bluetooth headset is connected, default sink is changed from the speaker to the headset, audio stream is rerouted accordingly. The speaker consistently remains as the default sink throughout the whole process (if I remember correctly).
However, I believe wp lua scripts do not include the logic to set ALVR as the default sink and change sound route when ALVR is started (or when the HMD is connected?).
A dedicated lua script should be installed to solve the "default audio" problem, like installing an udev rule file. I am not familiar with writing wp lua scripts, but wireplumber is designed in this way. In other words, only "pipewire session manager" should be responsible for changing sound routes, applications (except for special applications like easyeffects) should never touch the sound route.
For pipewire-media-session, it should also have similar mechanism.

@The-personified-devil
Copy link
Collaborator Author

We don't really want to support more than wireplumber, since pw-media-session is effectively deprecated. And we can't really ship wp scripts because our preferred distribution route is the launcher or mobile (as in shouldn't be installed system wide) tarballs. We could create a script and ship it for the distros that actually package alvr (very few ones).

I much rather think we should instead focus on actually easily providing the user with feedback on how to act, i.e.:

B) Check if no streams are connected to us and warn the user that they might have to set alvr as default if they haven't already

@0chroma
Copy link

0chroma commented Aug 30, 2024

btw, to get pipewire working in the flatpak install instructions I needed to add xdg-run/pipewire-0 permissions via flatseal:

Screenshot from 2024-08-29 17-07-01

terminal equivalent should be flatpak override --user --filesystem="xdg-run/pipewire-0" com.valvesoftware.Steam (have not tested this though)

@The-personified-devil
Copy link
Collaborator Author

This has been done by #2512. The matter of making the alvr devices default I'll move to #2615

@github-project-automation github-project-automation bot moved this from Todo to Done in Roadmap Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

4 participants