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

@ -32,6 +32,7 @@
PW_LOG_TOPIC_EXTERN(pulse_conn);
#define client_emit_disconnect(c) spa_hook_list_call(&(c)->listener_list, struct client_events, disconnect, 0)
#define client_emit_routes_changed(c) spa_hook_list_call(&(c)->listener_list, struct client_events, routes_changed, 0)
struct client *client_new(struct server *server)
{
@ -169,6 +170,16 @@ void client_free(struct client *client)
free(client);
}
void client_update_routes(struct client *client, const char *key, const char *value)
{
if (key == NULL)
pw_properties_clear(client->routes);
else
pw_properties_set(client->routes, key, value);
client_emit_routes_changed(client);
}
int client_queue_message(struct client *client, struct message *msg)
{
struct impl *impl = client->impl;