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

@ -73,6 +73,8 @@ typedef enum pa_resample_flags {
PA_RESAMPLER_CONSUME_LFE = 0x0040U,
} pa_resample_flags_t;
#define PA_RESAMPLER_MAX_HISTORY 64
struct pa_resampler {
pa_resample_method_t method;
pa_resample_flags_t flags;