pulse-server: implement stream-restore EVENT

Add method to update the client routes. Add an event when the client
routes changed.

Listen for route_changed events on clients that do a subscribe on the
stream-restore extension. Emit an EVENT when the routes change.

This keeps the system notifications volumes in sync between
gnome-control center and pavucontrol and probably in other tools
as well.

Fixes #3805
This commit is contained in:
Wim Taymans 2024-01-23 13:28:44 +01:00
parent d71fb40989
commit ac91c0dc1c
4 changed files with 138 additions and 13 deletions

View file

@ -85,10 +85,12 @@ struct client {
};
struct client_events {
#define VERSION_CLIENT_EVENTS 0
#define VERSION_CLIENT_EVENTS 1
uint32_t version;
void (*disconnect) (void *data);
void (*routes_changed) (void *data);
};
struct client *client_new(struct server *server);
@ -99,6 +101,8 @@ int client_queue_message(struct client *client, struct message *msg);
int client_flush_messages(struct client *client);
int client_queue_subscribe_event(struct client *client, uint32_t mask, uint32_t event, uint32_t id);
void client_update_routes(struct client *client, const char *key, const char *value);
static inline void client_unref(struct client *client)
{
if (--client->ref == 0)