mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-10-07 16:39:15 +00:00
stream: implement prefetch
When the audioconverter needs more data, let it return NEED_DATA. This can happen before the ports actually have consumed all the input data. For example, then the next cycle would require 1024 samples but there are currently only 16 samples queued, the next cycle will consume the 16 samples and then need another buffer to produce output. For rt streams, this is not a problem because a new buffer will be fetched in the next cycle synchronously. When the stream is async, we can use this NEED_DATA to prefetch a new buffer so that we have one in the next cycle. This fixes hickups with async streams that provide random sized buffers.
This commit is contained in:
parent
9714ce83d4
commit
e53eefef0d
|
@ -2642,9 +2642,10 @@ static int impl_node_process(void *object)
|
|||
spa_log_trace_fp(this->log, "%p: no output buffer", this);
|
||||
}
|
||||
}
|
||||
resample_update_rate_match(this, resample_passthrough,
|
||||
if (resample_update_rate_match(this, resample_passthrough,
|
||||
max_out - this->out_offset,
|
||||
max_in - this->in_offset);
|
||||
max_in - this->in_offset) > 0)
|
||||
res |= SPA_STATUS_NEED_DATA;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -1061,6 +1061,10 @@ again:
|
|||
pw_log_trace_fp("%p: no more buffers %p", stream, io);
|
||||
ask_more = true;
|
||||
}
|
||||
} else {
|
||||
ask_more = !impl->process_rt &&
|
||||
queue_is_empty(impl, &impl->queued) &&
|
||||
!queue_is_empty(impl, &impl->dequeued);
|
||||
}
|
||||
|
||||
copy_position(impl, impl->queued.outcount);
|
||||
|
|
Loading…
Reference in a new issue