roc-streaming / roc-toolkit

Real-time audio streaming over the network.
https://roc-streaming.org
Mozilla Public License 2.0
1.06k stars 213 forks source link

Auto-detect appropriate audio backend #198

Closed gavv closed 1 year ago

gavv commented 5 years ago

If the driver and device are omitted, roc-recv and roc-send tools select the default driver and device. When it is done, they always prefer PulseAudio over ALSA if both were enabled during build.

If the tools were built with PulseAudio support enabled but are running on a system without PulseAudio daemon installed, this becomes a problem.

To fix this, we should check at run time whether PulseAudio daemon is really available on the system and don't try to use it if it's not.

We already have sndio::BackendDispatcher that selects an appropriate backend by calling probe() on all supported backends and selecting the first one that returned true. When the driver and device are omitted, it calls probe(NULL, NULL).

Hence, all we need is to update PulseaudioBackend::probe() so that it will return false if the driver and device are NULL and the PulseAudio daemon is not available on the system.

It's a question how we can check this. Probably we can do it somehow using libpulse API.

See also #251. It provides an overview of roc_sndio concepts.

enigmaro commented 4 years ago

Hello @gavv , I just looked at this project and it seems very exciting to contribute to. I was wondering if I could pick up on this issue if it has not been assigned to anyone else.

gavv commented 4 years ago

@enigmaro Great, you're welcome, the issue is free.

gavv commented 4 years ago

Hi, saw your message on IRC, but you're offline already, so answering here.

Is it a valid approach to check if the PulseAudio daemon is running during run time to check if a simple context connection can be made to the default PulseAudio Server?

Sounds good. Let's try it and see how it'll work.

gavv commented 4 years ago

BTW if you want to receive offline messages on IRC, see here https://roc-streaming.org/toolkit/docs/about_project/contacts.html

gavv commented 3 years ago

@enigmaro Hi! Do you still have plans on this?