From 03bc36a502abda4a388cb411d9307820f3ad59e6 Mon Sep 17 00:00:00 2001 From: Julian Bouzas Date: Mon, 20 Jul 2020 09:37:23 -0400 Subject: [PATCH] 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. --- spa/plugins/audioconvert/resample-native.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spa/plugins/audioconvert/resample-native.c b/spa/plugins/audioconvert/resample-native.c index d87a4ab13..ad967d2f7 100644 --- a/spa/plugins/audioconvert/resample-native.c +++ b/spa/plugins/audioconvert/resample-native.c @@ -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 */