mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
client-node: improve cleanup
This commit is contained in:
parent
3777d9612e
commit
5ee287d79b
4 changed files with 25 additions and 9 deletions
|
|
@ -162,6 +162,7 @@ static void node_destroy(void *data)
|
||||||
|
|
||||||
pw_properties_free(n->props);
|
pw_properties_free(n->props);
|
||||||
spa_list_for_each_safe(p, tmp, &n->ports, link) {
|
spa_list_for_each_safe(p, tmp, &n->ports, link) {
|
||||||
|
pw_port_set_mix(p->port, NULL, 0);
|
||||||
spa_list_remove(&p->link);
|
spa_list_remove(&p->link);
|
||||||
spa_handle_clear(p->spa_handle);
|
spa_handle_clear(p->spa_handle);
|
||||||
free(p);
|
free(p);
|
||||||
|
|
|
||||||
|
|
@ -588,11 +588,11 @@ impl_node_port_use_buffers(struct spa_node *node,
|
||||||
|
|
||||||
port = GET_PORT(this, direction, port_id);
|
port = GET_PORT(this, direction, port_id);
|
||||||
|
|
||||||
spa_return_val_if_fail(port->have_format, -EIO);
|
|
||||||
|
|
||||||
spa_log_info(this->log, NAME " %p: use buffers %d on port %d:%d",
|
spa_log_info(this->log, NAME " %p: use buffers %d on port %d:%d",
|
||||||
this, n_buffers, direction, port_id);
|
this, n_buffers, direction, port_id);
|
||||||
|
|
||||||
|
spa_return_val_if_fail(port->have_format, -EIO);
|
||||||
|
|
||||||
clear_buffers(this, port);
|
clear_buffers(this, port);
|
||||||
|
|
||||||
for (i = 0; i < n_buffers; i++) {
|
for (i = 0; i < n_buffers; i++) {
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ struct port {
|
||||||
struct pw_properties *properties;
|
struct pw_properties *properties;
|
||||||
|
|
||||||
int have_format:1;
|
int have_format:1;
|
||||||
|
int removed:1;
|
||||||
uint32_t n_params;
|
uint32_t n_params;
|
||||||
struct spa_pod **params;
|
struct spa_pod **params;
|
||||||
|
|
||||||
|
|
@ -596,7 +597,7 @@ clear_port(struct node *this, struct port *port)
|
||||||
spa_log_debug(this->log, "node %p: clear port %p", this, port);
|
spa_log_debug(this->log, "node %p: clear port %p", this, port);
|
||||||
|
|
||||||
if (port == NULL)
|
if (port == NULL)
|
||||||
return ;
|
return;
|
||||||
|
|
||||||
do_update_port(this, port,
|
do_update_port(this, port,
|
||||||
PW_CLIENT_NODE_PORT_UPDATE_PARAMS |
|
PW_CLIENT_NODE_PORT_UPDATE_PARAMS |
|
||||||
|
|
@ -619,6 +620,7 @@ clear_port(struct node *this, struct port *port)
|
||||||
this->n_outputs--;
|
this->n_outputs--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!port->removed)
|
||||||
spa_node_emit_port_info(&this->hooks, port->direction, port->id, NULL);
|
spa_node_emit_port_info(&this->hooks, port->direction, port->id, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1518,6 +1520,7 @@ static void node_port_removed(void *data, struct pw_port *port)
|
||||||
|
|
||||||
pw_log_debug("client-node %p: port %p remove", &impl->this, port);
|
pw_log_debug("client-node %p: port %p remove", &impl->this, port);
|
||||||
|
|
||||||
|
p->removed = true;
|
||||||
clear_port(this, p);
|
clear_port(this, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1103,9 +1103,15 @@ static void client_node_destroy(void *data)
|
||||||
|
|
||||||
pw_node_set_driver(impl->client_node->node, NULL);
|
pw_node_set_driver(impl->client_node->node, NULL);
|
||||||
|
|
||||||
spa_hook_remove(&impl->client_node_listener);
|
|
||||||
spa_hook_remove(&impl->node_listener);
|
spa_hook_remove(&impl->node_listener);
|
||||||
pw_node_destroy(impl->this.node);
|
pw_node_destroy(impl->this.node);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void client_node_free(void *data)
|
||||||
|
{
|
||||||
|
struct impl *impl = data;
|
||||||
|
pw_log_debug("client-stream %p: free", &impl->this);
|
||||||
|
spa_hook_remove(&impl->client_node_listener);
|
||||||
cleanup(impl);
|
cleanup(impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1138,21 +1144,26 @@ static void client_node_info_changed(void *data, const struct pw_node_info *info
|
||||||
static const struct pw_node_events client_node_events = {
|
static const struct pw_node_events client_node_events = {
|
||||||
PW_VERSION_NODE_EVENTS,
|
PW_VERSION_NODE_EVENTS,
|
||||||
.destroy = client_node_destroy,
|
.destroy = client_node_destroy,
|
||||||
|
.free = client_node_free,
|
||||||
.initialized = client_node_initialized,
|
.initialized = client_node_initialized,
|
||||||
.result = client_node_result,
|
.result = client_node_result,
|
||||||
.active_changed = client_node_active_changed,
|
.active_changed = client_node_active_changed,
|
||||||
.info_changed = client_node_info_changed,
|
.info_changed = client_node_info_changed,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void node_destroy(void *data)
|
||||||
|
{
|
||||||
|
struct impl *impl = data;
|
||||||
|
pw_log_debug("client-stream %p: destroy", &impl->this);
|
||||||
|
spa_hook_remove(&impl->client_node_listener);
|
||||||
|
pw_client_node_destroy(impl->client_node);
|
||||||
|
}
|
||||||
|
|
||||||
static void node_free(void *data)
|
static void node_free(void *data)
|
||||||
{
|
{
|
||||||
struct impl *impl = data;
|
struct impl *impl = data;
|
||||||
|
|
||||||
pw_log_debug("client-stream %p: free", &impl->this);
|
pw_log_debug("client-stream %p: free", &impl->this);
|
||||||
|
|
||||||
spa_hook_remove(&impl->node_listener);
|
spa_hook_remove(&impl->node_listener);
|
||||||
spa_hook_remove(&impl->client_node_listener);
|
|
||||||
pw_client_node_destroy(impl->client_node);
|
|
||||||
cleanup(impl);
|
cleanup(impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1184,6 +1195,7 @@ static void node_driver_changed(void *data, struct pw_node *old, struct pw_node
|
||||||
|
|
||||||
static const struct pw_node_events node_events = {
|
static const struct pw_node_events node_events = {
|
||||||
PW_VERSION_NODE_EVENTS,
|
PW_VERSION_NODE_EVENTS,
|
||||||
|
.destroy = node_destroy,
|
||||||
.free = node_free,
|
.free = node_free,
|
||||||
.initialized = node_initialized,
|
.initialized = node_initialized,
|
||||||
.peer_added = node_peer_added,
|
.peer_added = node_peer_added,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue