stream-restore: Don't save the default sink/source as a target

If the default sink or source is set as the target, just don't save
the new target so that it follows the new default.

This is a workaround for gnome-control-center first setting the
default source/sink and then setting the targets on all
stream-restore database entries to the new default. Setting an
explicit target will pin the stream to that sink/source forever,
which is then making pavucontrol default source/sink toggle
fail.

See #676
This commit is contained in:
Wim Taymans 2021-03-06 20:08:11 +01:00
parent d9b80fda37
commit 5712992fc9

View file

@ -238,7 +238,9 @@ static int do_extension_stream_restore_write(struct client *client, uint32_t com
fprintf(f, "%s\"%s\"", (i == 0 ? " ":", "), channel_id2name(map.map[i])); fprintf(f, "%s\"%s\"", (i == 0 ? " ":", "), channel_id2name(map.map[i]));
fprintf(f, " ]"); fprintf(f, " ]");
} }
if (device_name != NULL && device_name[0]) if (device_name != NULL && device_name[0] &&
strcmp(device_name, client->default_source) != 0 &&
strcmp(device_name, client->default_sink) != 0)
fprintf(f, ", \"target-node\": \"%s\"", device_name); fprintf(f, ", \"target-node\": \"%s\"", device_name);
fprintf(f, " }"); fprintf(f, " }");
fclose(f); fclose(f);