media-session: add alsa.reserve property to alsa-monitor

This commit is contained in:
Jonas Holmberg 2021-02-09 17:08:03 +01:00 committed by Wim Taymans
parent 640f34d8e2
commit d624ed26f4
2 changed files with 12 additions and 6 deletions

View file

@ -6,6 +6,9 @@ properties = {
# not used by the session manager, in order to be able to
# connect to the real JACK server.
#alsa.jack-device = false
# Reserve devices.
#alsa.reserve = true
}
rules = [

View file

@ -1026,12 +1026,15 @@ int sm_alsa_monitor_start(struct sm_media_session *session)
if ((str = pw_properties_get(impl->conf, "properties")) != NULL)
pw_properties_update_string(impl->props, str, strlen(str));
if (session->dbus_connection)
impl->conn = spa_dbus_connection_get(session->dbus_connection);
if (impl->conn == NULL)
pw_log_warn("no dbus connection, device reservation disabled");
else
pw_log_debug("got dbus connection %p", impl->conn);
if ((str = pw_properties_get(impl->props, "alsa.reserve")) == NULL ||
pw_properties_parse_bool(str)) {
if (session->dbus_connection)
impl->conn = spa_dbus_connection_get(session->dbus_connection);
if (impl->conn == NULL)
pw_log_warn("no dbus connection, device reservation disabled");
else
pw_log_debug("got dbus connection %p", impl->conn);
}
impl->handle = pw_context_load_spa_handle(context, SPA_NAME_API_ALSA_ENUM_UDEV, NULL);
if (impl->handle == NULL) {