mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
spa: improve draining
Make a new DRAINED status. Place the DRAINED status on an input IO when a stream is out of buffers and draining. All nodes that don't have HAVE_DATA on the input io need to copy it to the output io and return the status. This makes sure the DRAINED is forwarded and nodes return DRAINED from _process() DRAINED on the resampler flushes out the last queued samples and then forwards the DRAINED in the next iteration. Emit a new drained signal from the context when a node returns DRAINED. Use this to trigger the drained signal in the stream.
This commit is contained in:
parent
029f431418
commit
b18dacde9a
10 changed files with 46 additions and 42 deletions
|
|
@ -865,7 +865,7 @@ impl_node_port_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id)
|
|||
static int impl_node_process(void *object)
|
||||
{
|
||||
struct impl *this = object;
|
||||
int status;
|
||||
int status = 0;
|
||||
|
||||
spa_log_trace_fp(this->log, "%p: process convert:%u master:%d",
|
||||
this, this->use_converter, this->master);
|
||||
|
|
@ -875,22 +875,17 @@ static int impl_node_process(void *object)
|
|||
status = spa_node_process(this->convert);
|
||||
}
|
||||
|
||||
status = spa_node_process(this->follower);
|
||||
if (status >= 0)
|
||||
status = spa_node_process(this->follower);
|
||||
|
||||
if (this->direction == SPA_DIRECTION_OUTPUT &&
|
||||
!this->master && this->use_converter) {
|
||||
while (true) {
|
||||
while (status >= 0) {
|
||||
status = spa_node_process(this->convert);
|
||||
if (status & SPA_STATUS_HAVE_DATA)
|
||||
if (status & (SPA_STATUS_HAVE_DATA | SPA_STATUS_DRAINED))
|
||||
break;
|
||||
|
||||
if (status & SPA_STATUS_NEED_DATA) {
|
||||
if (status & SPA_STATUS_NEED_DATA)
|
||||
status = spa_node_process(this->follower);
|
||||
if (!(status & SPA_STATUS_HAVE_DATA)) {
|
||||
spa_node_call_xrun(&this->callbacks, 0, 0, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
spa_log_trace_fp(this->log, "%p: process status:%d", this, status);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue