mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-16 07:00:00 -05:00
resample-peaks: fix peaks resampler
Keep separate variable to check if we searched a complete chunk.
This commit is contained in:
parent
0a27040c9a
commit
a331779a28
2 changed files with 8 additions and 10 deletions
|
|
@ -46,18 +46,16 @@ static void impl_peaks_process(struct resample *r, int channel,
|
|||
{
|
||||
struct peaks_data *pd = r->data;
|
||||
float *s = src, *d = dst;
|
||||
int i, o, end;
|
||||
int i, o, end, chunk;
|
||||
|
||||
i = ((uint64_t) pd->o_count * r->i_rate) / r->o_rate;
|
||||
i = i > pd->i_count ? i - pd->i_count : 0;
|
||||
o = 0;
|
||||
o = i = 0;
|
||||
|
||||
while (i < *in_len && o < *out_len) {
|
||||
end = ((uint64_t) (pd->o_count + 1) * r->i_rate) / r->o_rate;
|
||||
end = ((uint64_t) (pd->o_count + 1) * r->i_rate) / r->o_rate;
|
||||
end = end > pd->i_count ? end - pd->i_count : 0;
|
||||
end = SPA_MIN(end, *in_len);
|
||||
chunk = SPA_MIN(end, *in_len);
|
||||
|
||||
for (; i < end; i++) {
|
||||
for (; i < chunk; i++) {
|
||||
float n = fabsf(s[i]);
|
||||
if (n > pd->max_f[channel])
|
||||
pd->max_f[channel] = n;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue