pulse-server: handle 0 id as default sink/source as well

Also handle 0 id as the default sink/source

See #756
This commit is contained in:
Wim Taymans 2021-03-30 10:15:36 +02:00
parent efd52d633f
commit dd6a18d576

View file

@ -4538,8 +4538,11 @@ static int do_get_info(struct client *client, uint32_t command, uint32_t tag, st
if (sel.id != SPA_ID_INVALID && sel.value != NULL)
goto error_invalid;
pw_log_info(NAME" %p: [%s] %s tag:%u idx:%u name:%s", impl, client->name,
commands[command].name, tag, sel.id, sel.value);
if (command == COMMAND_GET_SINK_INFO || command == COMMAND_GET_SOURCE_INFO) {
if ((sel.value == NULL && sel.id == SPA_ID_INVALID) ||
if ((sel.value == NULL && (sel.id == SPA_ID_INVALID || sel.id == 0)) ||
(sel.value != NULL && (strcmp(sel.value, def) == 0 || strcmp(sel.value, "0")) == 0))
sel.value = get_default(client, command == COMMAND_GET_SINK_INFO);
} else {
@ -4547,9 +4550,6 @@ static int do_get_info(struct client *client, uint32_t command, uint32_t tag, st
goto error_invalid;
}
pw_log_info(NAME" %p: [%s] %s tag:%u idx:%u name:%s", impl, client->name,
commands[command].name, tag, sel.id, sel.value);
if (command == COMMAND_GET_SOURCE_INFO &&
sel.value != NULL && pw_endswith(sel.value, ".monitor")) {
sel.value = strndupa(sel.value, strlen(sel.value)-8);