diff --git a/pinos/server/link.c b/pinos/server/link.c index 7857a6ca9..e66d24dee 100644 --- a/pinos/server/link.c +++ b/pinos/server/link.c @@ -36,7 +36,6 @@ typedef struct int refcount; PinosWorkQueue *work; - uint32_t seq; SpaFormat **format_filter; PinosProperties *properties; @@ -561,6 +560,7 @@ static SpaResult do_start (PinosLink *this, SpaNodeState in_state, SpaNodeState out_state) { SpaResult res = SPA_RESULT_OK; + PinosLinkImpl *impl = SPA_CONTAINER_OF (this, PinosLinkImpl, this); if (in_state < SPA_NODE_STATE_PAUSED || out_state < SPA_NODE_STATE_PAUSED) return SPA_RESULT_OK; @@ -571,9 +571,11 @@ do_start (PinosLink *this, SpaNodeState in_state, SpaNodeState out_state) if (in_state == SPA_NODE_STATE_PAUSED) { res = pinos_node_set_state (this->input->node, PINOS_NODE_STATE_RUNNING); + pinos_work_queue_add (impl->work, this->input->node, res, NULL, NULL); } if (out_state == SPA_NODE_STATE_PAUSED) { res = pinos_node_set_state (this->output->node, PINOS_NODE_STATE_RUNNING); + pinos_work_queue_add (impl->work, this->input->node, res, NULL, NULL); } } return res; @@ -750,6 +752,8 @@ pinos_link_free (PinosLink *link) pinos_log_debug ("link %p: free", link); pinos_signal_emit (&link->free_signal, link); + pinos_work_queue_destroy (impl->work); + if (impl->allocated) pinos_memblock_free (&impl->buffer_mem); @@ -982,10 +986,6 @@ pinos_link_destroy (PinosLink * this) pinos_global_destroy (this->global); spa_list_remove (&this->link); - pinos_work_queue_cancel (impl->work, - this, - SPA_ID_INVALID); - spa_list_for_each_safe (resource, tmp, &this->resource_list, link) pinos_resource_destroy (resource); @@ -996,7 +996,7 @@ pinos_link_destroy (PinosLink * this) impl->refcount++; pinos_loop_invoke (this->input->node->data_loop->loop, do_link_remove, - impl->seq++, + 1, 0, NULL, this); @@ -1008,7 +1008,7 @@ pinos_link_destroy (PinosLink * this) impl->refcount++; pinos_loop_invoke (this->output->node->data_loop->loop, do_link_remove, - impl->seq++, + 2, 0, NULL, this); diff --git a/pinos/server/node.c b/pinos/server/node.c index 615c5ec0a..39c1a820b 100644 --- a/pinos/server/node.c +++ b/pinos/server/node.c @@ -34,8 +34,6 @@ typedef struct PinosWorkQueue *work; - uint32_t seq; - bool async_init; } PinosNodeImpl; @@ -583,6 +581,8 @@ do_node_remove_done (SpaLoop *loop, pinos_log_debug ("node %p: free", this); pinos_signal_emit (&this->free_signal, this); + pinos_work_queue_destroy (impl->work); + if (this->transport) pinos_transport_destroy (this->transport); if (this->input_port_map) @@ -657,16 +657,12 @@ pinos_node_destroy (PinosNode * this) spa_list_remove (&this->link); pinos_global_destroy (this->global); - pinos_work_queue_cancel (impl->work, - this, - SPA_ID_INVALID); - spa_list_for_each_safe (resource, tmp, &this->resource_list, link) pinos_resource_destroy (resource); pinos_loop_invoke (this->data_loop->loop, do_node_remove, - impl->seq++, + 1, 0, NULL, this); diff --git a/pinos/server/work-queue.c b/pinos/server/work-queue.c index 1bac32b22..cd3bb50c9 100644 --- a/pinos/server/work-queue.c +++ b/pinos/server/work-queue.c @@ -119,6 +119,8 @@ pinos_work_queue_destroy (PinosWorkQueue * queue) spa_list_for_each_safe (item, tmp, &impl->free_list, link) free (item); + spa_list_for_each_safe (item, tmp, &impl->work_list, link) + free (item); free (impl); }