pulse-server: don't consider monitor nodes when finding the default source

If a system does not have any Audio/Source node, clients that want to capture
audio from the default source should fail instead of capturing audio from a
monitor Audio/Sink node.
This commit is contained in:
Julian Bouzas 2026-06-26 11:55:05 -04:00 committed by Wim Taymans
parent 855735d720
commit 8d93b779cd

View file

@ -2527,7 +2527,7 @@ static const char *get_default(struct client *client, bool sink)
struct selector sel; struct selector sel;
struct pw_manager *manager = client->manager; struct pw_manager *manager = client->manager;
struct pw_manager_object *o; struct pw_manager_object *o;
const char *def, *str, *mon; const char *def, *str;
spa_zero(sel); spa_zero(sel);
if (sink) { if (sink) {
@ -2536,7 +2536,7 @@ static const char *get_default(struct client *client, bool sink)
sel.value = client->default_sink; sel.value = client->default_sink;
def = DEFAULT_SINK; def = DEFAULT_SINK;
} else { } else {
sel.type = pw_manager_object_is_source_or_monitor; sel.type = pw_manager_object_is_source;
sel.key = PW_KEY_NODE_NAME; sel.key = PW_KEY_NODE_NAME;
sel.value = client->default_source; sel.value = client->default_source;
def = DEFAULT_SOURCE; def = DEFAULT_SOURCE;
@ -2547,17 +2547,6 @@ static const char *get_default(struct client *client, bool sink)
if (o == NULL || o->props == NULL) if (o == NULL || o->props == NULL)
return def; return def;
str = pw_properties_get(o->props, PW_KEY_NODE_NAME); str = pw_properties_get(o->props, PW_KEY_NODE_NAME);
if (!sink && pw_manager_object_is_monitor(o)) {
def = DEFAULT_MONITOR;
if (str != NULL &&
(mon = pw_properties_get(o->props, PW_KEY_NODE_NAME".monitor")) == NULL) {
pw_properties_setf(o->props,
PW_KEY_NODE_NAME".monitor",
"%s.monitor", str);
}
str = pw_properties_get(o->props, PW_KEY_NODE_NAME".monitor");
}
if (str == NULL) if (str == NULL)
str = def; str = def;
return str; return str;