|
1 # HG changeset patch |
|
2 # Parent b65da7e13aaee4756135be04016e081a95e86855 |
|
3 # User Karl Tomlinson <karlt+@karlt.net> |
|
4 b=973374 complete speex_resampler_reset_mem r=jmspeex |
|
5 |
|
6 sample_frac_num is the array most likely to be non-zero after resampling a |
|
7 previous stream, but the other arrays can also be left at non-zero values |
|
8 in other situations. |
|
9 |
|
10 diff --git a/media/libspeex_resampler/src/resample.c b/media/libspeex_resampler/src/resample.c |
|
11 --- a/media/libspeex_resampler/src/resample.c |
|
12 +++ b/media/libspeex_resampler/src/resample.c |
|
13 @@ -1141,16 +1141,22 @@ SPX_RESAMPLE_EXPORT int speex_resampler_ |
|
14 for (i=0;i<st->nb_channels;i++) |
|
15 st->last_sample[i] = st->filt_len/2; |
|
16 return RESAMPLER_ERR_SUCCESS; |
|
17 } |
|
18 |
|
19 SPX_RESAMPLE_EXPORT int speex_resampler_reset_mem(SpeexResamplerState *st) |
|
20 { |
|
21 spx_uint32_t i; |
|
22 + for (i=0;i<st->nb_channels;i++) |
|
23 + { |
|
24 + st->last_sample[i] = 0; |
|
25 + st->magic_samples[i] = 0; |
|
26 + st->samp_frac_num[i] = 0; |
|
27 + } |
|
28 for (i=0;i<st->nb_channels*(st->filt_len-1);i++) |
|
29 st->mem[i] = 0; |
|
30 return RESAMPLER_ERR_SUCCESS; |
|
31 } |
|
32 |
|
33 SPX_RESAMPLE_EXPORT const char *speex_resampler_strerror(int err) |
|
34 { |
|
35 switch (err) |