diff --git a/media/libspeex_resampler/hugemem.patch b/media/libspeex_resampler/hugemem.patch index 81462ab6bccf..4e1f5baa6cf3 100644 --- a/media/libspeex_resampler/hugemem.patch +++ b/media/libspeex_resampler/hugemem.patch @@ -20,7 +20,8 @@ diff --git a/media/libspeex_resampler/src/resample.c b/media/libspeex_resampler/ #include "speex_resampler.h" #include "arch.h" #else /* OUTSIDE_SPEEX */ -@@ -633,24 +635,23 @@ static int update_filter(SpeexResamplerS +@@ -632,25 +634,26 @@ static int update_filter(SpeexResamplerS + st->oversample >>= 1; if (st->oversample < 1) st->oversample = 1; } else { @@ -28,17 +29,20 @@ diff --git a/media/libspeex_resampler/src/resample.c b/media/libspeex_resampler/ st->cutoff = quality_map[st->quality].upsample_bandwidth; } - /* Choose the resampling type that requires the least amount of memory */ +- /* Choose the resampling type that requires the least amount of memory */ -#ifdef RESAMPLE_FULL_SINC_TABLE - use_direct = 1; - if (INT_MAX/sizeof(spx_word16_t)/st->den_rate < st->filt_len) - goto fail; + use_direct = +#ifdef RESAMPLE_HUGEMEM -+ st->den_rate <= 16*(st->oversample+8) ++ /* Choose the direct resampler, even with higher initialization costs, ++ when resampling any multiple of 100 to 44100. */ ++ st->den_rate <= 441 #else - use_direct = st->filt_len*st->den_rate <= st->filt_len*st->oversample+8 -+ st->filt_len*st->den_rate <= st->filt_len*st->oversample+8 ++ /* Choose the resampling type that requires the least amount of memory */ ++ st->filt_len*st->den_rate <= st->filt_len*st->oversample+8 +#endif && INT_MAX/sizeof(spx_word16_t)/st->den_rate >= st->filt_len; -#endif diff --git a/media/libspeex_resampler/src/resample.c b/media/libspeex_resampler/src/resample.c index a3a22ee8b36d..83ad119d4513 100644 --- a/media/libspeex_resampler/src/resample.c +++ b/media/libspeex_resampler/src/resample.c @@ -639,12 +639,14 @@ static int update_filter(SpeexResamplerState *st) st->cutoff = quality_map[st->quality].upsample_bandwidth; } - /* Choose the resampling type that requires the least amount of memory */ use_direct = #ifdef RESAMPLE_HUGEMEM - st->den_rate <= 16*(st->oversample+8) + /* Choose the direct resampler, even with higher initialization costs, + when resampling any multiple of 100 to 44100. */ + st->den_rate <= 441 #else - st->filt_len*st->den_rate <= st->filt_len*st->oversample+8 + /* Choose the resampling type that requires the least amount of memory */ + st->filt_len*st->den_rate <= st->filt_len*st->oversample+8 #endif && INT_MAX/sizeof(spx_word16_t)/st->den_rate >= st->filt_len; if (use_direct)