diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-12-06 10:14:28 +0400 |
---|---|---|
committer | Tristan Matthews <le.businessman@gmail.com> | 2013-12-06 10:14:28 +0400 |
commit | b0204ccee86d5e2281488ad24be579933f0c7afc (patch) | |
tree | 2a1d70d9650f74a65fffcddc03bc53deedeb919e | |
parent | a8d85b7fb4c12f73588085678be58b7cd118322b (diff) |
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.
Signed-off-by: Tristan Matthews <le.businessman@gmail.com>
-rw-r--r-- | libspeexdsp/resample.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libspeexdsp/resample.c b/libspeexdsp/resample.c index c451969..2d033d3 100644 --- a/libspeexdsp/resample.c +++ b/libspeexdsp/resample.c @@ -960,13 +960,15 @@ EXPORT int speex_resampler_process_interleaved_float(SpeexResamplerState *st, co { 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 @@ -981,13 +983,15 @@ EXPORT int speex_resampler_process_interleaved_int(SpeexResamplerState *st, cons { 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 |