resample-native: substract num of skipped samples after processing input

Takes into account the number of skipped samples when deciding whether
we should copy the remaining samples in the history or not.

Fixes dropping audio issue when resampling from high frequencies
such as 48KHz to low requencies such as 8KHz.
This commit is contained in:
Julian Bouzas 2020-07-20 09:37:23 -04:00
parent 7bd7476426
commit 03bc36a502

View file

@ -258,13 +258,13 @@ static void impl_native_process(struct resample *r,
int skip = in - hist;
/* we are past the history and can now work on the new
* input data */
in = *in_len - skip;
in = *in_len;
data->func(r, src, skip, &in, dst, out, out_len);
spa_log_trace_fp(r->log, "native %p: in:%d/%d out %d/%d",
r, *in_len, in, *out_len, out);
remain = *in_len - in;
remain = *in_len - skip - in;
if (remain > 0 && remain < n_taps) {
/* not enough input data remaining for more output,
* copy to history */