From b5b01f4dd29c6a80ef884a3149741e09fe01672e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 5 Jul 2023 14:07:30 +0200 Subject: [PATCH] resample-peaks: improve peaks some more Update the i_count in the loop because we use it to check when we have completed a chunk. --- spa/plugins/audioconvert/resample-peaks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spa/plugins/audioconvert/resample-peaks.c b/spa/plugins/audioconvert/resample-peaks.c index b680070ee..a418e1544 100644 --- a/spa/plugins/audioconvert/resample-peaks.c +++ b/spa/plugins/audioconvert/resample-peaks.c @@ -44,6 +44,7 @@ static void resample_peaks_process(struct resample *r, m = peaks_abs_max(&pd->peaks, &s[i], chunk, m); i += chunk; + i_count += chunk; if (chunk == end) { d[o++] = m; @@ -56,7 +57,7 @@ static void resample_peaks_process(struct resample *r, *out_len = o; *in_len = i; pd->o_count = o_count; - pd->i_count = i_count + i; + pd->i_count = i_count; while (pd->i_count >= r->i_rate && pd->o_count >= r->o_rate) { pd->i_count -= r->i_rate;