mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
pipewire: use newly added function for deferred module destroy
Use the newly introduced `pw_impl_module_schedule_destroy()`
for deferred module destroy in all modules except
module-example-{sink,source}.
This commit is contained in:
parent
a13e7ef091
commit
45bd8532eb
9 changed files with 25 additions and 203 deletions
|
|
@ -73,7 +73,6 @@ struct impl {
|
|||
|
||||
struct pw_impl_module *module;
|
||||
struct spa_hook module_listener;
|
||||
struct pw_work_queue *work;
|
||||
|
||||
struct pw_properties *properties;
|
||||
|
||||
|
|
@ -83,8 +82,6 @@ struct impl {
|
|||
AvahiServiceBrowser *source_browser;
|
||||
|
||||
struct spa_list tunnel_list;
|
||||
|
||||
unsigned int unloading:1;
|
||||
};
|
||||
|
||||
struct tunnel_info {
|
||||
|
|
@ -106,20 +103,6 @@ struct tunnel {
|
|||
|
||||
static int start_client(struct impl *impl);
|
||||
|
||||
static void do_unload_module(void *obj, void *data, int res, uint32_t id)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
pw_impl_module_destroy(impl->module);
|
||||
}
|
||||
|
||||
static void unload_module(struct impl *impl)
|
||||
{
|
||||
if (!impl->unloading) {
|
||||
impl->unloading = true;
|
||||
pw_work_queue_add(impl->work, impl, 0, do_unload_module, impl);
|
||||
}
|
||||
}
|
||||
|
||||
static struct tunnel *make_tunnel(struct impl *impl, const struct tunnel_info *info)
|
||||
{
|
||||
struct tunnel *t;
|
||||
|
|
@ -173,8 +156,6 @@ static void impl_free(struct impl *impl)
|
|||
if (impl->avahi_poll)
|
||||
pw_avahi_poll_free(impl->avahi_poll);
|
||||
pw_properties_free(impl->properties);
|
||||
if (impl->work)
|
||||
pw_work_queue_cancel(impl->work, impl, SPA_ID_INVALID);
|
||||
free(impl);
|
||||
}
|
||||
|
||||
|
|
@ -483,7 +464,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda
|
|||
}
|
||||
return;
|
||||
error:
|
||||
unload_module(impl);
|
||||
pw_impl_module_schedule_destroy(impl->module);
|
||||
}
|
||||
|
||||
static int start_client(struct impl *impl)
|
||||
|
|
@ -494,7 +475,7 @@ static int start_client(struct impl *impl)
|
|||
client_callback, impl,
|
||||
&res)) == NULL) {
|
||||
pw_log_error("can't create client: %s", avahi_strerror(res));
|
||||
unload_module(impl);
|
||||
pw_impl_module_schedule_destroy(impl->module);
|
||||
return -EIO;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -539,8 +520,6 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
impl->context = context;
|
||||
impl->properties = props;
|
||||
|
||||
impl->work = pw_context_get_work_queue(context);
|
||||
|
||||
pw_impl_module_add_listener(module, &impl->module_listener, &module_events, impl);
|
||||
|
||||
pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue