mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
node: implement activation
Make an eventfd for each node and listen for events when the node is activated. Reorganize some graphs links to make it possible to activiate nodes by signaling the eventfd Pass the peer node to each remote node and let the remote node directly activate the peer when needed. Let each node signal the driver node when finished. With this we don't need to go through the daemon to schedule the graph, nodes will simply activate eachother. We only go to the server when there is a server node to schedule. Keep stats about the state of each node and the time it was triggered, running and finished.
This commit is contained in:
parent
f45e0b8966
commit
5de7898808
15 changed files with 470 additions and 173 deletions
|
|
@ -671,7 +671,7 @@ static int impl_node_process(struct spa_node *node)
|
|||
}
|
||||
|
||||
if (spa_list_is_empty(&this->ready))
|
||||
return -EPIPE;
|
||||
return SPA_STATUS_OK;
|
||||
|
||||
b = spa_list_first(&this->ready, struct buffer, link);
|
||||
spa_list_remove(&b->link);
|
||||
|
|
|
|||
|
|
@ -782,6 +782,7 @@ push_frames(struct state *state,
|
|||
struct buffer *b;
|
||||
struct spa_data *d;
|
||||
uint32_t index, offs, avail, l0, l1;
|
||||
struct spa_io_buffers *io;
|
||||
|
||||
b = spa_list_first(&state->free, struct buffer, link);
|
||||
spa_list_remove(&b->link);
|
||||
|
|
@ -814,7 +815,15 @@ push_frames(struct state *state,
|
|||
d[0].chunk->stride = state->frame_size;
|
||||
|
||||
SPA_FLAG_SET(b->flags, BUFFER_FLAG_OUT);
|
||||
spa_list_append(&state->ready, &b->link);
|
||||
|
||||
io = state->io;
|
||||
if (io != NULL && io->status != SPA_STATUS_HAVE_BUFFER) {
|
||||
io->buffer_id = b->id;
|
||||
io->status = SPA_STATUS_HAVE_BUFFER;
|
||||
}
|
||||
else {
|
||||
spa_list_append(&state->ready, &b->link);
|
||||
}
|
||||
|
||||
state->callbacks->process(state->callbacks_data, SPA_STATUS_HAVE_BUFFER);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -909,7 +909,7 @@ static int impl_node_process(struct spa_node *node)
|
|||
}
|
||||
|
||||
if (spa_list_is_empty(&port->queue))
|
||||
return -EPIPE;
|
||||
return SPA_STATUS_OK;
|
||||
|
||||
b = spa_list_first(&port->queue, struct buffer, link);
|
||||
spa_list_remove(&b->link);
|
||||
|
|
|
|||
|
|
@ -1145,6 +1145,7 @@ static int mmap_read(struct impl *this)
|
|||
{
|
||||
struct port *port = &this->out_ports[0];
|
||||
struct spa_v4l2_device *dev = &port->dev;
|
||||
struct spa_io_buffers *io;
|
||||
struct v4l2_buffer buf;
|
||||
struct buffer *b;
|
||||
struct spa_data *d;
|
||||
|
|
@ -1158,6 +1159,7 @@ static int mmap_read(struct impl *this)
|
|||
return -errno;
|
||||
|
||||
pts = SPA_TIMEVAL_TO_NSEC(&buf.timestamp);
|
||||
spa_log_trace(this->log, "v4l2 %p: have output %d", this, buf.index);
|
||||
|
||||
if (this->clock) {
|
||||
this->clock->nsec = pts;
|
||||
|
|
@ -1180,9 +1182,17 @@ static int mmap_read(struct impl *this)
|
|||
d[0].chunk->stride = port->fmt.fmt.pix.bytesperline;
|
||||
|
||||
SPA_FLAG_SET(b->flags, BUFFER_FLAG_OUTSTANDING);
|
||||
spa_list_append(&port->queue, &b->link);
|
||||
|
||||
spa_log_trace(this->log, "v4l2 %p: have output %d", this, buf.index);
|
||||
io = port->io;
|
||||
if (io != NULL && io->status != SPA_STATUS_HAVE_BUFFER) {
|
||||
io->buffer_id = b->id;
|
||||
io->status = SPA_STATUS_HAVE_BUFFER;
|
||||
}
|
||||
else {
|
||||
spa_list_append(&port->queue, &b->link);
|
||||
}
|
||||
|
||||
spa_log_trace(this->log, "v4l2 %p: now queued %d", this, b->id);
|
||||
this->callbacks->process(this->callbacks_data, SPA_STATUS_HAVE_BUFFER);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue