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

Linux pipewire integration (Audio + Microphone) #1973

Merged
merged 21 commits into from
Jul 6, 2024

Conversation

Meister1593
Copy link
Collaborator

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

@Meister1593 Meister1593 marked this pull request as draft February 4, 2024 20:12
@zmerp
Copy link
Member

zmerp commented Feb 5, 2024

I haven't reviewed completely. But linux specific code should go in crates/audio/src/linux.rs

@Meister1593
Copy link
Collaborator Author

Meister1593 commented Feb 5, 2024

I haven't reviewed completely. But linux specific code should go in crates/audio/src/linux.rs

Please don't review it completely yet, its just in barely compilable state, not ready for any serious review of the code itself.

@guysoft
Copy link

guysoft commented Feb 26, 2024

Cool! Any way to help?

@Vixea
Copy link
Collaborator

Vixea commented Feb 26, 2024

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

@Meister1593 Meister1593 force-pushed the pipewire-microphone branch 3 times, most recently from 69a43ad to 725909f Compare March 17, 2024 18:17
@zmerp zmerp force-pushed the master branch 2 times, most recently from d01478e to 005c4c7 Compare March 22, 2024 09:18
@Meister1593 Meister1593 force-pushed the pipewire-microphone branch from 725909f to 62cffbb Compare April 6, 2024 14:32
@Meister1593
Copy link
Collaborator Author

Current progress: Both audio sink and microphone source are being created and working correctly!
What's left to do: Refactor platform-specific code, overalll cleanup code and make UI edits to allow for native pipewire, make it default with fallback to cpal in case pipewire is missing or outdated (this specifically - unlikely scenario? code needs at least 0.3.49 pipewire).

@Meister1593 Meister1593 self-assigned this Jun 5, 2024
@Meister1593 Meister1593 force-pushed the pipewire-microphone branch 2 times, most recently from af70b11 to bbe16df Compare June 5, 2024 13:46
@zmerp
Copy link
Member

zmerp commented Jun 5, 2024

I would say that the pipewire audio code can replace cpal for linux.

@The-personified-devil
Copy link
Collaborator

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.

@Meister1593
Copy link
Collaborator Author

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.

@The-personified-devil
Copy link
Collaborator

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.

@Meister1593
Copy link
Collaborator Author

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
Would need to adjust ui with that as well, probably gonna make conditionals for audio section to remove parts of it on linux

@infidelus
Copy link

infidelus commented Jun 6, 2024

I've considered removing cpal, but i know that linux mint is still on pulse

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). :)

@Meister1593 Meister1593 changed the title Draft: Linux pipewire integration Linux pipewire integration (Sink + Microphone) Jun 9, 2024
@Meister1593 Meister1593 marked this pull request as ready for review June 9, 2024 17:40
@Meister1593
Copy link
Collaborator Author

Meister1593 commented Jun 9, 2024

In current state:
Creates sink (ALVR Audio) and microphone (ALVR Microphone), they are working as a regular device (no different to others)
image
Replaced audio presets to just toggles
image
Advanced audio will be changed to hide older cpal device list for linux (not in this PR)

Only thing left to do is remove on connect script from setup guide, maybe even make a migration so that it will be removed to not interfere with pipewire from this PR

Opened PR for review, for suggestions, and will use it for the time being to find any inconsistencies or issues if there will be any

@Meister1593 Meister1593 changed the title Linux pipewire integration (Sink + Microphone) Linux pipewire integration (Audio + Microphone) Jun 9, 2024
Copy link
Collaborator

@The-personified-devil The-personified-devil left a 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

alvr/dashboard/src/data_sources.rs Outdated Show resolved Hide resolved
alvr/audio/src/lib.rs Outdated Show resolved Hide resolved
alvr/audio/src/lib.rs Outdated Show resolved Hide resolved
alvr/audio/src/lib.rs Show resolved Hide resolved
alvr/client_core/src/audio.rs Outdated Show resolved Hide resolved
alvr/server/src/connection.rs Show resolved Hide resolved
alvr/audio/src/linux.rs Outdated Show resolved Hide resolved
alvr/server/src/connection.rs Show resolved Hide resolved
@Meister1593 Meister1593 requested a review from zmerp July 3, 2024 16:35
Vixea
Vixea previously approved these changes Jul 3, 2024
@The-personified-devil
Copy link
Collaborator

Apart from the noted changes this lgmt, but I'm not fit to review rust code style

alvr/audio/src/linux.rs Outdated Show resolved Hide resolved
alvr/audio/src/linux.rs Outdated Show resolved Hide resolved
alvr/dashboard/src/dashboard/components/settings.rs Outdated Show resolved Hide resolved
alvr/server/src/connection.rs Show resolved Hide resolved
alvr/server/src/connection.rs Show resolved Hide resolved
@Meister1593 Meister1593 requested a review from zmerp July 6, 2024 14:17
alvr/audio/src/linux.rs Outdated Show resolved Hide resolved
alvr/dashboard/src/dashboard/components/settings.rs Outdated Show resolved Hide resolved
@zmerp zmerp merged commit 8aba8e8 into alvr-org:master Jul 6, 2024
8 checks passed
zmerp pushed a commit that referenced this pull request Jul 6, 2024
* Linux pipewire implementation

* Add pipewire libs to release

* Remove wrong client name

* Clippy fixes

* Type annotated to any on game audio sender

* Attempt to fix macos type infer

* Revert "Attempt to fix macos type infer"

This reverts commit 83e27b5.

* Check clippy compile

* Revert "Check clippy compile"

This reverts commit c8a1623.

* Fix macos clippy

* Nullify infer

* PR review fixes

* PR review fix #2

* PR review fixes #2

* Missed cfg for windows

* Remove -

* PR review fixes. Fixed prepare release pipeline

* Adjust wiki for building with libpipewire/libspa

* Remove unnecessary log

* PR review

* Fix default audio config
@The-personified-devil The-personified-devil linked an issue Jul 8, 2024 that may be closed by this pull request
failboat78 pushed a commit to failboat78/ALVR that referenced this pull request Aug 17, 2024
* Linux pipewire implementation

* Add pipewire libs to release

* Remove wrong client name

* Clippy fixes

* Type annotated to any on game audio sender

* Attempt to fix macos type infer

* Revert "Attempt to fix macos type infer"

This reverts commit 83e27b5.

* Check clippy compile

* Revert "Check clippy compile"

This reverts commit c8a1623.

* Fix macos clippy

* Nullify infer

* PR review fixes

* PR review fix alvr-org#2

* PR review fixes alvr-org#2

* Missed cfg for windows

* Remove -

* PR review fixes. Fixed prepare release pipeline

* Adjust wiki for building with libpipewire/libspa

* Remove unnecessary log

* PR review

* Fix default audio config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment