b=973374 complete speex_resampler_reset_mem r=jmspeex

sample_frac_num is the array most likely to be non-zero after resampling a
previous stream, but the other arrays can also be left at non-zero values
in other situations.

--HG--
extra : rebase_source : dfd3974f051ff0b1794a937d712dda185352f7d5
This commit is contained in:
Karl Tomlinson 2014-02-18 09:52:20 +13:00
parent 4fc6f5492a
commit 889f94ff35
3 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,35 @@
# HG changeset patch
# Parent b65da7e13aaee4756135be04016e081a95e86855
# User Karl Tomlinson <karlt+@karlt.net>
b=973374 complete speex_resampler_reset_mem r=jmspeex
sample_frac_num is the array most likely to be non-zero after resampling a
previous stream, but the other arrays can also be left at non-zero values
in other situations.
diff --git a/media/libspeex_resampler/src/resample.c b/media/libspeex_resampler/src/resample.c
--- a/media/libspeex_resampler/src/resample.c
+++ b/media/libspeex_resampler/src/resample.c
@@ -1141,16 +1141,22 @@ SPX_RESAMPLE_EXPORT int speex_resampler_
for (i=0;i<st->nb_channels;i++)
st->last_sample[i] = st->filt_len/2;
return RESAMPLER_ERR_SUCCESS;
}
SPX_RESAMPLE_EXPORT int speex_resampler_reset_mem(SpeexResamplerState *st)
{
spx_uint32_t i;
+ for (i=0;i<st->nb_channels;i++)
+ {
+ st->last_sample[i] = 0;
+ st->magic_samples[i] = 0;
+ st->samp_frac_num[i] = 0;
+ }
for (i=0;i<st->nb_channels*(st->filt_len-1);i++)
st->mem[i] = 0;
return RESAMPLER_ERR_SUCCESS;
}
SPX_RESAMPLE_EXPORT const char *speex_resampler_strerror(int err)
{
switch (err)

View File

@ -1146,6 +1146,12 @@ SPX_RESAMPLE_EXPORT int speex_resampler_skip_zeros(SpeexResamplerState *st)
SPX_RESAMPLE_EXPORT int speex_resampler_reset_mem(SpeexResamplerState *st)
{
spx_uint32_t i;
for (i=0;i<st->nb_channels;i++)
{
st->last_sample[i] = 0;
st->magic_samples[i] = 0;
st->samp_frac_num[i] = 0;
}
for (i=0;i<st->nb_channels*(st->filt_len-1);i++)
st->mem[i] = 0;
return RESAMPLER_ERR_SUCCESS;

View File

@ -19,3 +19,4 @@ cp $1/COPYING .
# apply outstanding local patches
patch -p1 < sse-detect-runtime.patch
patch -p3 < reset.patch