mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
Improve upload
Only send a buffer when we have received a NEED_DATA message. Add a signal to pulla buffer from the sink. Restructure the sink to use a queue like the source and only push a buffer when we can. Improve SpaData. Offset and size should be between 0 and maxsize, make sure we clamp correctly when needed. node_process_output completes the processing of the output after receiving HAVE_OUTPUT for async elements. It instructs the node that it now can produce more output.
This commit is contained in:
parent
8ce3f949e2
commit
5b0b9c43d0
18 changed files with 201 additions and 112 deletions
|
|
@ -192,6 +192,7 @@ pinos_stream_new (PinosContext *context,
|
|||
pinos_signal_init (&this->add_buffer);
|
||||
pinos_signal_init (&this->remove_buffer);
|
||||
pinos_signal_init (&this->new_buffer);
|
||||
pinos_signal_init (&this->need_buffer);
|
||||
|
||||
this->state = PINOS_STREAM_STATE_UNCONNECTED;
|
||||
|
||||
|
|
@ -473,6 +474,9 @@ on_rtsocket_condition (SpaSource *source,
|
|||
handle_rtnode_event (stream, ev);
|
||||
}
|
||||
}
|
||||
if (cmd & PINOS_TRANSPORT_CMD_NEED_DATA) {
|
||||
pinos_signal_emit (&stream->need_buffer, stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1080,16 +1084,15 @@ pinos_stream_send_buffer (PinosStream *stream,
|
|||
{
|
||||
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
|
||||
BufferId *bid;
|
||||
uint8_t cmd = PINOS_TRANSPORT_CMD_HAVE_DATA;
|
||||
|
||||
if ((bid = find_buffer (stream, id))) {
|
||||
uint8_t cmd = PINOS_TRANSPORT_CMD_HAVE_DATA;
|
||||
|
||||
bid->used = true;
|
||||
impl->trans->outputs[0].buffer_id = id;
|
||||
impl->trans->outputs[0].status = SPA_RESULT_OK;
|
||||
write (impl->rtfd, &cmd, 1);
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
if (write (impl->rtfd, &cmd, 1) < 1)
|
||||
perror ("write");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue