mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
use spa_list_append when we can
This commit is contained in:
parent
4aaa2cbc6b
commit
a691d07531
21 changed files with 41 additions and 42 deletions
|
|
@ -59,7 +59,7 @@ static inline void spa_graph_data_port_check(struct spa_graph_data *data, struct
|
|||
if (required > 0 && node->ready[SPA_DIRECTION_INPUT] == required) {
|
||||
node->state = SPA_GRAPH_STATE_IN;
|
||||
if (node->ready_link.next == NULL)
|
||||
spa_list_insert(data->ready.prev, &node->ready_link);
|
||||
spa_list_append(&data->ready, &node->ready_link);
|
||||
} else if (node->ready_link.next) {
|
||||
spa_list_remove(&node->ready_link);
|
||||
node->ready_link.next = NULL;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ static inline void spa_graph_port_check(struct spa_graph *graph, struct spa_grap
|
|||
if (node->required > 0 && node->ready == node->required) {
|
||||
node->action = SPA_GRAPH_ACTION_IN;
|
||||
if (node->ready_link.next == NULL)
|
||||
spa_list_insert(graph->ready.prev, &node->ready_link);
|
||||
spa_list_append(&graph->ready, &node->ready_link);
|
||||
} else if (node->ready_link.next) {
|
||||
spa_list_remove(&node->ready_link);
|
||||
node->ready_link.next = NULL;
|
||||
|
|
@ -117,7 +117,7 @@ next:
|
|||
n->state = SPA_GRAPH_STATE_CHECK_OUT;
|
||||
else if (state == SPA_RESULT_OK)
|
||||
n->state = SPA_GRAPH_STATE_CHECK_OK;
|
||||
spa_list_insert(graph->ready.prev, &n->ready_link);
|
||||
spa_list_append(&graph->ready, &n->ready_link);
|
||||
}
|
||||
else {
|
||||
spa_graph_node_update(graph, n);
|
||||
|
|
@ -133,8 +133,7 @@ next:
|
|||
|| pn->flags & SPA_GRAPH_NODE_FLAG_ASYNC) {
|
||||
pn->state = SPA_GRAPH_STATE_OUT;
|
||||
spa_debug("node %p add ready OUT", n);
|
||||
spa_list_insert(graph->ready.prev,
|
||||
&pn->ready_link);
|
||||
spa_list_append(&graph->ready, &pn->ready_link);
|
||||
}
|
||||
} else if (p->io->status == SPA_RESULT_OK)
|
||||
n->ready++;
|
||||
|
|
@ -167,7 +166,7 @@ static inline void spa_graph_scheduler_pull(struct spa_graph *graph, struct spa_
|
|||
graph->node = node;
|
||||
spa_debug("node %p start pull", node);
|
||||
if (node->ready_link.next == NULL)
|
||||
spa_list_insert(graph->ready.prev, &node->ready_link);
|
||||
spa_list_append(&graph->ready, &node->ready_link);
|
||||
}
|
||||
|
||||
static inline void spa_graph_scheduler_push(struct spa_graph *graph, struct spa_graph_node *node)
|
||||
|
|
@ -176,7 +175,7 @@ static inline void spa_graph_scheduler_push(struct spa_graph *graph, struct spa_
|
|||
graph->node = node;
|
||||
spa_debug("node %p start push", node);
|
||||
if (node->ready_link.next == NULL)
|
||||
spa_list_insert(graph->ready.prev, &node->ready_link);
|
||||
spa_list_append(&graph->ready, &node->ready_link);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -541,7 +541,7 @@ static int impl_node_process_input(struct spa_node *node)
|
|||
|
||||
spa_log_trace(this->log, NAME " %p: queue buffer %u", this, input->buffer_id);
|
||||
|
||||
spa_list_insert(this->ready.prev, &b->link);
|
||||
spa_list_append(&this->ready, &b->link);
|
||||
b->outstanding = false;
|
||||
input->buffer_id = SPA_ID_INVALID;
|
||||
input->status = SPA_RESULT_OK;
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ static void recycle_buffer(struct state *this, uint32_t buffer_id)
|
|||
spa_return_if_fail(b->outstanding);
|
||||
|
||||
b->outstanding = false;
|
||||
spa_list_insert(this->free.prev, &b->link);
|
||||
spa_list_append(&this->free, &b->link);
|
||||
}
|
||||
|
||||
static int clear_buffers(struct state *this)
|
||||
|
|
@ -448,7 +448,7 @@ impl_node_port_use_buffers(struct spa_node *node,
|
|||
spa_log_error(this->log, NAME " %p: need mapped memory", this);
|
||||
return SPA_RESULT_ERROR;
|
||||
}
|
||||
spa_list_insert(this->free.prev, &b->link);
|
||||
spa_list_append(&this->free, &b->link);
|
||||
}
|
||||
this->n_buffers = n_buffers;
|
||||
|
||||
|
|
|
|||
|
|
@ -532,7 +532,7 @@ impl_node_port_use_buffers(struct spa_node *node,
|
|||
return SPA_RESULT_ERROR;
|
||||
}
|
||||
if (!b->outstanding)
|
||||
spa_list_insert(port->queue.prev, &b->link);
|
||||
spa_list_append(&port->queue, &b->link);
|
||||
}
|
||||
port->n_buffers = n_buffers;
|
||||
|
||||
|
|
@ -582,7 +582,7 @@ static void recycle_buffer(struct impl *this, uint32_t id)
|
|||
return;
|
||||
}
|
||||
|
||||
spa_list_insert(port->queue.prev, &b->link);
|
||||
spa_list_append(&port->queue, &b->link);
|
||||
b->outstanding = false;
|
||||
spa_log_trace(this->log, NAME " %p: recycle buffer %d", this, id);
|
||||
}
|
||||
|
|
@ -735,7 +735,7 @@ static int impl_node_process_input(struct spa_node *node)
|
|||
inio->buffer_id = SPA_ID_INVALID;
|
||||
inio->status = SPA_RESULT_OK;
|
||||
|
||||
spa_list_insert(inport->queue.prev, &b->link);
|
||||
spa_list_append(&inport->queue, &b->link);
|
||||
inport->queued_bytes += b->outbuf->datas[0].chunk->size;
|
||||
|
||||
spa_log_trace(this->log, NAME " %p: queue buffer %d on port %d %zd %zd",
|
||||
|
|
|
|||
|
|
@ -649,7 +649,7 @@ static int impl_node_process_input(struct spa_node *node)
|
|||
|
||||
spa_log_trace(this->log, NAME " %p: queue buffer %u", this, input->buffer_id);
|
||||
|
||||
spa_list_insert(this->ready.prev, &b->link);
|
||||
spa_list_append(&this->ready, &b->link);
|
||||
b->outstanding = false;
|
||||
|
||||
input->buffer_id = SPA_ID_INVALID;
|
||||
|
|
|
|||
|
|
@ -583,7 +583,7 @@ impl_node_port_use_buffers(struct spa_node *node,
|
|||
spa_log_error(this->log, NAME " %p: invalid memory on buffer %p", this,
|
||||
buffers[i]);
|
||||
}
|
||||
spa_list_insert(this->empty.prev, &b->link);
|
||||
spa_list_append(&this->empty, &b->link);
|
||||
}
|
||||
this->n_buffers = n_buffers;
|
||||
this->underrun = false;
|
||||
|
|
@ -641,7 +641,7 @@ static inline void reuse_buffer(struct impl *this, uint32_t id)
|
|||
spa_log_trace(this->log, NAME " %p: reuse buffer %d", this, id);
|
||||
|
||||
b->outstanding = false;
|
||||
spa_list_insert(this->empty.prev, &b->link);
|
||||
spa_list_append(&this->empty, &b->link);
|
||||
|
||||
if (this->underrun) {
|
||||
set_timer(this, true);
|
||||
|
|
|
|||
|
|
@ -583,7 +583,7 @@ static void recycle_buffer(struct impl *this, uint32_t id)
|
|||
return;
|
||||
}
|
||||
|
||||
spa_list_insert(port->empty.prev, &b->link);
|
||||
spa_list_append(&port->empty, &b->link);
|
||||
b->outstanding = false;
|
||||
spa_log_trace(this->log, NAME " %p: recycle buffer %d", this, id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue