pulse-server: use async reply for set_default_sink/source

Because we set the default sink/source before calling the metadata,
we don't send out updates about the new sink and this confuses
pavucontrol.

Instead, use the new async reply to reply once the new metadata has
been configured and the defaults have been updated.
This commit is contained in:
Wim Taymans 2021-03-11 15:39:19 +01:00
parent fdcbe67941
commit a5922a9c0a

View file

@ -4897,13 +4897,6 @@ static int do_set_default(struct client *client, uint32_t command, uint32_t tag,
if (name != NULL && (o = find_device(client, SPA_ID_INVALID, name, sink)) == NULL) if (name != NULL && (o = find_device(client, SPA_ID_INVALID, name, sink)) == NULL)
return -ENOENT; return -ENOENT;
if (sink) {
free(client->default_sink);
client->default_sink = name ? strdup(name) : NULL;
} else {
free(client->default_source);
client->default_source = name ? strdup(name) : NULL;
}
if (name != NULL) { if (name != NULL) {
res = pw_manager_set_metadata(manager, client->metadata_default, res = pw_manager_set_metadata(manager, client->metadata_default,
PW_ID_CORE, PW_ID_CORE,
@ -4918,7 +4911,7 @@ static int do_set_default(struct client *client, uint32_t command, uint32_t tag,
if (res < 0) if (res < 0)
return res; return res;
return reply_simple_ack(client, tag); return operation_new(client, tag);
} }
static int do_suspend(struct client *client, uint32_t command, uint32_t tag, struct message *m) static int do_suspend(struct client *client, uint32_t command, uint32_t tag, struct message *m)