sink-input: Add history memblockq

A new memblockq is added to the sink input code to keep some history of the
input data. The queue is kept in sync with the render memblockq. The old input
data will be used to prepare the resampler after a rewind.

pa_resampler_request() and pa_resampler_result() have been changed to round
as good as possible to avoid loosing or duplicating samples during rewinds.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/120>
This commit is contained in:
Georg Chini 2021-01-01 00:21:30 +01:00 committed by PulseAudio Marge Bot
parent 90ccfc1688
commit 1bfabd6512
4 changed files with 134 additions and 34 deletions

View file

@ -252,6 +252,10 @@ struct pa_sink_input {
/* We maintain a history of resampled audio data here. */
pa_memblockq *render_memblockq;
/* This queue keeps the history before resampling and is used
* when rewinding the resampler. */
pa_memblockq *history_memblockq;
pa_sink_input *sync_prev, *sync_next;
/* The requested latency for the sink */