-
-
Notifications
You must be signed in to change notification settings - Fork 455
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
Linux pipewire integration (Audio + Microphone) #1973
base: master
Are you sure you want to change the base?
Conversation
I haven't reviewed completely. But linux specific code should go in |
Please don't review it completely yet, its just in barely compilable state, not ready for any serious review of the code itself. |
Cool! Any way to help? |
no not really unless you wanna pull a night of just reading documentation on oboe(not the rust crate but the google software one) oh and you somehow figure out what we're doing wrong so you have to know Rust too |
69a43ad
to
725909f
Compare
d01478e
to
005c4c7
Compare
Changed chan size to proper, as well as audio format to f32 Uncommitted older changes Updated pipewire libs, adapted code to new pipewire lib version, issue with moving threads for pipewire Sink creation done, pipewire-rs and alvr compiled, no buffer copying yet Dropped unnecessary custom pw-rs, tokio. Code cleanup and move to single mainloop thread. Cfg cleanup Changed cfgs to not linux for android client compatibility Removed unnecessary pipewire code from client Renamed microphone output for linux pipewire, removed Audio Type Updated Cargo.lock Started implementing channels for pipewire to handle buffers Implemented basic buffer, almost completely non functional, code related to actual bufferring needs to be re-added Refactored flow, experimenting with byte types, order, etc Added comment about graceful shutdown Fixed steamvr shutdown. Experimenting with alternative ways to process streamed data
725909f
to
62cffbb
Compare
… - fixed large delay
Current progress: Both audio sink and microphone source are being created and working correctly! |
8d108d0
to
6e5a546
Compare
af70b11
to
bbe16df
Compare
I would say that the pipewire audio code can replace cpal for linux. |
I think a fair amount of people still run pulseaudio and for them audio would not work at all. So either we make pipewire a hard requirement or we keep the cpal code around for the time being. |
I've considered removing cpal, but i know that linux mint is still on pulse That said, they won't have microphone and they can technically switch to pipewire (and they should really) I'm 50/50 about this, but inclined to removing cpal from linux and going pipewire all the way, and point people to install pipewire. |
I looked at it and basically all big distros (arch, debian, ubuntu, fedora, centos) have been shipping pipewire as default for at least a year, and every other sane distro has support for it. Even Mint will ship it as default in the upcoming release. So I think forcing pipewire should be the thing. |
Then i think that settles it, i would remove cpal from linux completely |
Linux Mint will be moving to PipeWire from the next release - https://blog.linuxmint.com/?p=4660. Obviously there will still be those on earlier versions of LM that are still on PulseAudio though, although maybe it'll be the nudge those users need to upgrade (or install PipeWire separately). :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't really review the actual linux pipewire code yet because I don't have enough time rn
@@ -231,7 +232,7 @@ impl DataSources { | |||
match ws.read() { | |||
Ok(tungstenite::Message::Text(json_string)) => { | |||
if let Ok(event) = serde_json::from_str(&json_string) { | |||
debug!("Server event received: {:?}", event); | |||
// debug!("Server event received: {:?}", event); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we not want to keep this? Cleaning up the logging is a different issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unintentional, it was spamming into logs too much, couldn't see anything else because of it, just commented for the dev time
alvr/audio/src/lib.rs
Outdated
}; | ||
} | ||
|
||
#[cfg(target_os = "android")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to move this out into it's own file if it's android only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plus as far as I can tell this code is also invoked on the non-android clients
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/alvr-org/ALVR/blob/master/alvr/client_core/src/connection.rs#L327
As far as I can tell this code is relevant for all clients, not just android. If that's actually the case then you should rename that file from android to client and feature gate it as "not windows and not linux"
} | ||
|
||
// returns (sink, source) | ||
pub fn new_virtual_microphone_pair(config: MicrophoneDevicesConfig) -> Result<(Self, Self)> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what to do here, since this isn't needed on the client so it could just always return an error, but idk if it wouldn't be used in a potential future macos port
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i'm kind of divivded about this as well, it's never used and i don't know what to do with it
This is not done by any means, just put up for anyone to see how things are progressing
So far: main flow (pipewire source, getting data from one place to another) is kinda done, but i've yet to determine why only thing i get is pops into mic, it might be a multiple issues at once (buffer overload + trying to push all at once)
Other issues are listed in TODO's