Use the PULSE_SERVER env var to locate the pulseaudio socket#229
Conversation
| .context("XDR_RUNTIME_DIR should not contain null characters") | ||
| .ok() | ||
| } else { | ||
| eprintln!( |
There was a problem hiding this comment.
is this needed?
There was a problem hiding this comment.
When I was debugging the issue of having no sound in muvm running in a Snap sandbox, there were no useful diagnostic messages as far as I remember. I decided to add some, just in case.
There was a problem hiding this comment.
Right, but you can return a Result here, and only do the error print if both of them fail
There was a problem hiding this comment.
I could, but then the error message would have less context. The way it's done now, not only does it tell you that the PA socket is missing but it also tells you where it got the path from.
Note that this won't be a spurious warning, as this function is called only as a last resort.
There was a problem hiding this comment.
I still think that it should return a Result, for example your .context calls are useless, as the .ok immediately discards the error message.
There was a problem hiding this comment.
I've made it return Result<CString> though now the call site is way complex than before. Someone who doesn't know Rust really shouldn't be making such complex refactorings.
There was a problem hiding this comment.
The second helper also has the same issue
d1bacc0 to
0166db4
Compare
0166db4 to
a197aea
Compare
If it's missing, fall back to appending "pulse/native" to
XDG_RUNTIME_DIR.
The thing is, when running in a Snap confined environment,
XDG_RUNTIME_DIR will be something like this:
/run/user/<UID>/snap.<SNAP_NAME>
while PULSE_SERVER will be:
unix:/run/user/<UID>/snap.<SNAP_NAME>/../pulse/native
Because apps expect XDG_RUNTIME_DIR to be writable and the
Snap runtime doesn't want Snaps polluting the system
XDG_RUNTIME_DIR, it mounts `/run/user/<UID>` as read-only
but then mounts a read-write `snap.<SNAP_NAME>` subdirectory
under it, setting XDG_RUNTIME_DIR to that writable subdirectory.
Signed-off-by: Joseph Artsimovich <joseph.artsimovich@gmx.com>
a197aea to
9772276
Compare
This change makes sound in muvm work in a Snap sandbox. The commit message explains exactly what the patch does and why it's necessary.
I've been applying this patch to muvm that I ship as part of the arm64 Snap build of Wine Bar for a month or two already - seems to work well.
Just keep in mind I don't really know Rust - the code is not necessarily the most optimal or elegant.
Also, I haven't tested it with the latest version of muvm. I currently ship
muvm-0.5.1as part of WineBar.