pulse-server: module does not depend on client

We don't need to pass the client to the module create and load
functions, they can work without a client.

The only place the client is used is to access the properties to make a
new connection to pipewire. This is also however not a good idea, we
should simply use the defaults used by the context or else a client
could set strange properties like remote.name etc for these internal
connections.

Also removing the dependency of the client will make it possible to load
modules from the startup script or other modules later.
This commit is contained in:
Wim Taymans 2022-12-06 18:26:29 +01:00
parent 80cb1d2566
commit 865d41b986
27 changed files with 40 additions and 48 deletions

View file

@ -5131,6 +5131,7 @@ static int do_load_module(struct client *client, uint32_t command, uint32_t tag,
.sync = on_load_module_manager_sync,
};
struct impl *impl = client->impl;
const char *name, *argument;
struct module *module;
struct pending_module *pm;
@ -5145,7 +5146,7 @@ static int do_load_module(struct client *client, uint32_t command, uint32_t tag,
pw_log_info("[%s] %s name:%s argument:%s",
client->name, commands[command].name, name, argument);
module = module_create(client, name, argument);
module = module_create(impl, name, argument);
if (module == NULL)
return -errno;
@ -5159,7 +5160,7 @@ static int do_load_module(struct client *client, uint32_t command, uint32_t tag,
pw_log_debug("pending module %p: start tag:%d", pm, tag);
r = module_load(client, module);
r = module_load(module);
module_add_listener(module, &pm->module_listener, &module_events, pm);
client_add_listener(client, &pm->client_listener, &client_events, pm);