ref: 5adadc5626ee2d5d3a3ca21e70fd195b9d002a0b
parent: bcdf4d9553031e52072e590b91db9a28724f790e
author: Jean-Marc Valin <[email protected]>
date: Wed Aug 1 09:19:38 EDT 2012
Properly save in_len for multiple channels in the resampler. This fixes issues with clicking in one channel and/or truncation with some unusual sample rates.
--- a/src/resample.c
+++ b/src/resample.c
@@ -966,13 +966,15 @@
{
spx_uint32_t i;
int istride_save, ostride_save;
- spx_uint32_t bak_len = *out_len;
+ spx_uint32_t bak_out_len = *out_len;
+ spx_uint32_t bak_in_len = *in_len;
istride_save = st->in_stride;
ostride_save = st->out_stride;
st->in_stride = st->out_stride = st->nb_channels;
for (i=0;i<st->nb_channels;i++)
{
- *out_len = bak_len;
+ *out_len = bak_out_len;
+ *in_len = bak_in_len;
if (in != NULL)
speex_resampler_process_float(st, i, in+i, in_len, out+i, out_len);
else
@@ -987,13 +989,15 @@
{
spx_uint32_t i;
int istride_save, ostride_save;
- spx_uint32_t bak_len = *out_len;
+ spx_uint32_t bak_out_len = *out_len;
+ spx_uint32_t bak_in_len = *in_len;
istride_save = st->in_stride;
ostride_save = st->out_stride;
st->in_stride = st->out_stride = st->nb_channels;
for (i=0;i<st->nb_channels;i++)
{
- *out_len = bak_len;
+ *out_len = bak_out_len;
+ *in_len = bak_in_len;
if (in != NULL)
speex_resampler_process_int(st, i, in+i, in_len, out+i, out_len);
else