spa-resample: clamp float values

sndfile does not seem to correctly clip samples so we have to do it
ourselves.
This commit is contained in:
Wim Taymans 2025-12-09 13:37:37 +01:00
parent e1392cec0e
commit 8e6945c496

View file

@ -297,7 +297,7 @@ static int do_conversion(struct data *d)
if (pout_len > 0) {
for (k = 0, i = 0; i < pout_len; i++) {
for (j = 0; j < channels; j++) {
obuf[k++] = out[MAX_SAMPLES * j + i];
obuf[k++] = SPA_CLAMP(out[MAX_SAMPLES * j + i], -1.0f, 1.0f);
}
}
pout_len = sf_writef_float(d->ofile, obuf, pout_len);