alsa: add option to skip the busy check

Makes the card exposed even if some of the pcms are busy.

Fixes #3914
This commit is contained in:
Wim Taymans 2024-03-22 12:42:48 +01:00
parent e2ad924cbb
commit 4db0811878
2 changed files with 9 additions and 0 deletions

View File

@ -218,6 +218,10 @@ UNDOCUMENTED
@PAR@ device-param alsa.use-acp # boolean
Use \ref device-param__alsa_card_profiles "ALSA Card Profiles" (ACP) for device configuration.
@PAR@ device-param alsa.udev.expose-busy # boolean
Expose the ALSA card even if it is busy/in use. Default false. This can be useful when some
of the PCMs are in use by other applications but the other free PCMs should still be exposed.
## Device properties
@PAR@ device-param api.alsa.path # string

View File

@ -93,6 +93,7 @@ struct impl {
struct spa_source source;
struct spa_source notify;
unsigned int use_acp:1;
unsigned int expose_busy:1;
};
static int impl_udev_open(struct impl *this)
@ -382,6 +383,8 @@ static int check_pcm_device_availability(struct impl *this, struct card *card,
*/
res = 0;
if (this->expose_busy)
return res;
spa_scnprintf(path, sizeof(path), "/proc/asound/card%u", card->card_nr);
@ -1126,6 +1129,8 @@ impl_init(const struct spa_handle_factory *factory,
if (info) {
if ((str = spa_dict_lookup(info, "alsa.use-acp")) != NULL)
this->use_acp = spa_atob(str);
else if ((str = spa_dict_lookup(info, "alsa.udev.expose-busy")) != NULL)
this->expose_busy = spa_atob(str);
}
return 0;