pulse-server: make method to schedule module unload

This commit is contained in:
Wim Taymans 2021-04-21 13:11:16 +02:00
parent cd224942c7
commit fee8bf69dd
3 changed files with 8 additions and 2 deletions

View file

@ -34,6 +34,11 @@ static void on_module_unload(void *data, uint64_t count)
module_unload(NULL, module);
}
void module_schedule_unload(struct module *module)
{
pw_loop_signal_event(module->impl->loop, module->unload);
}
struct module *module_new(struct impl *impl, const struct module_methods *methods, size_t user_data)
{
struct module *module;

View file

@ -68,6 +68,7 @@ struct module {
};
struct module *module_new(struct impl *impl, const struct module_methods *methods, size_t user_data);
void module_schedule_unload(struct module *module);
void module_args_add_props(struct pw_properties *props, const char *str);
int module_args_to_audioinfo(struct impl *impl, struct pw_properties *props, struct spa_audio_info_raw *info);

View file

@ -85,7 +85,7 @@ static void on_core_error(void *data, uint32_t id, int seq, int res, const char
id, seq, res, spa_strerror(res), message);
if (id == PW_ID_CORE && res == -EPIPE)
pw_loop_signal_event(module->impl->loop, module->unload);
module_schedule_unload(module);
}
static const struct pw_core_events core_events = {
@ -101,7 +101,7 @@ static void on_stream_state_changed(void *data, enum pw_stream_state old,
if (state == PW_STREAM_STATE_UNCONNECTED) {
pw_log_info("stream disconnected, unloading");
pw_loop_signal_event(module->impl->loop, module->unload);
module_schedule_unload(module);
}
}