pulse-server: work around race condition in SET_DEFAULT/MOVE_*

The default metadata update may be delayed for some time after
SET_DEFAULT, since the session manager has to work on it.

MOVE_* commands need to know what the client thinks is the current
default sink, so that they can decide between "move to default" and
"move to specific device".

To avoid race condition here, stash the default value set by the client
and use it in the MOVE_* commands, until the metadata update arrives.
This commit is contained in:
Pauli Virtanen 2022-07-04 15:57:42 +03:00 committed by Wim Taymans
parent 6188e4d074
commit a46d4aedd7
3 changed files with 36 additions and 1 deletions

View file

@ -75,6 +75,8 @@ struct client {
struct pw_manager_object *metadata_default;
char *default_sink;
char *default_source;
char *temporary_default_sink; /**< pending value, for MOVE_* commands */
char *temporary_default_source; /**< pending value, for MOVE_* commands */
struct pw_manager_object *metadata_routes;
struct pw_properties *routes;