mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
context: clean up the settings object as well
This commit is contained in:
parent
1662e3834f
commit
4518eded5b
4 changed files with 26 additions and 9 deletions
|
|
@ -462,6 +462,8 @@ void pw_context_destroy(struct pw_context *context)
|
||||||
pw_properties_free(context->properties);
|
pw_properties_free(context->properties);
|
||||||
pw_properties_free(context->conf);
|
pw_properties_free(context->conf);
|
||||||
|
|
||||||
|
pw_settings_clean(context);
|
||||||
|
|
||||||
if (impl->dbus_handle)
|
if (impl->dbus_handle)
|
||||||
pw_unload_spa_handle(impl->dbus_handle);
|
pw_unload_spa_handle(impl->dbus_handle);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,8 +102,8 @@ static void core_event_add_mem(void *data, uint32_t id, uint32_t type, int fd, u
|
||||||
|
|
||||||
m = pw_mempool_import(this->pool, flags, type, fd);
|
m = pw_mempool_import(this->pool, flags, type, fd);
|
||||||
if (m->id != id) {
|
if (m->id != id) {
|
||||||
pw_log_error(NAME" %p: invalid mem id %u, expected %u",
|
pw_log_error(NAME" %p: invalid mem id %u, fd:%d expected %u",
|
||||||
this, id, m->id);
|
this, id, fd, m->id);
|
||||||
pw_proxy_errorf(&this->proxy, -EINVAL, "invalid mem id %u, expected %u", id, m->id);
|
pw_proxy_errorf(&this->proxy, -EINVAL, "invalid mem id %u, expected %u", id, m->id);
|
||||||
pw_memblock_unref(m);
|
pw_memblock_unref(m);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -410,6 +410,8 @@ struct pw_context {
|
||||||
struct settings defaults; /**< default parameters */
|
struct settings defaults; /**< default parameters */
|
||||||
struct settings settings; /**< current parameters */
|
struct settings settings; /**< current parameters */
|
||||||
|
|
||||||
|
void *settings_impl; /**< settings metadata */
|
||||||
|
|
||||||
struct pw_mempool *pool; /**< global memory pool */
|
struct pw_mempool *pool; /**< global memory pool */
|
||||||
|
|
||||||
struct pw_map globals; /**< map of globals */
|
struct pw_map globals; /**< map of globals */
|
||||||
|
|
@ -1242,6 +1244,7 @@ void pw_log_log_object(enum spa_log_level level, const char *file, int line,
|
||||||
bool pw_log_is_default(void);
|
bool pw_log_is_default(void);
|
||||||
|
|
||||||
int pw_settings_init(struct pw_context *context);
|
int pw_settings_init(struct pw_context *context);
|
||||||
|
void pw_settings_clean(struct pw_context *context);
|
||||||
|
|
||||||
/** \endcond */
|
/** \endcond */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,18 +114,18 @@ static void init_defaults(struct impl *impl)
|
||||||
PW_ID_CORE, "clock.force-rate", "", "%d", s->clock_force_rate);
|
PW_ID_CORE, "clock.force-rate", "", "%d", s->clock_force_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int pw_settings_init(struct pw_context *context)
|
int pw_settings_init(struct pw_context *context)
|
||||||
{
|
{
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
int res;
|
|
||||||
|
|
||||||
impl = calloc(1, sizeof(*impl));
|
impl = calloc(1, sizeof(*impl));
|
||||||
if (impl == NULL)
|
if (impl == NULL)
|
||||||
goto error_errno;
|
return -errno;
|
||||||
|
|
||||||
impl->context = context;
|
impl->context = context;
|
||||||
impl->metadata = pw_context_create_metadata(context, "settings", NULL, 0);
|
impl->metadata = pw_context_create_metadata(context, "settings", NULL, 0);
|
||||||
|
if (impl->metadata == NULL)
|
||||||
|
goto error_free;
|
||||||
|
|
||||||
init_defaults(impl);
|
init_defaults(impl);
|
||||||
|
|
||||||
|
|
@ -135,12 +135,24 @@ int pw_settings_init(struct pw_context *context)
|
||||||
|
|
||||||
pw_impl_metadata_register(impl->metadata, NULL);
|
pw_impl_metadata_register(impl->metadata, NULL);
|
||||||
|
|
||||||
|
context->settings_impl = impl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error_errno:
|
|
||||||
res = -errno;
|
|
||||||
goto error_free;
|
|
||||||
error_free:
|
error_free:
|
||||||
free(impl);
|
free(impl);
|
||||||
return res;
|
return -errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
void pw_settings_clean(struct pw_context *context)
|
||||||
|
{
|
||||||
|
struct impl *impl = context->settings_impl;
|
||||||
|
|
||||||
|
if (impl == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
context->settings_impl = NULL;
|
||||||
|
if (impl->metadata != NULL)
|
||||||
|
pw_impl_metadata_destroy(impl->metadata);
|
||||||
|
free(impl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue