vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Wed Dec  7 
21:23:27 2011 +0200| [86d9aabfe7e62477b6f6bb15a61c47df159c813f] | committer: 
Rémi Denis-Courmont

speex resampler: add 10% slack output space

This should fix buffer underflows when changing the playback rate.
We probably should instead reallocate the buffer and resume resampling
when the situation occurs, but that would be a lot more complicated.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=86d9aabfe7e62477b6f6bb15a61c47df159c813f
---

 modules/audio_filter/resampler/speex.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/modules/audio_filter/resampler/speex.c 
b/modules/audio_filter/resampler/speex.c
index f472b71..561261a 100644
--- a/modules/audio_filter/resampler/speex.c
+++ b/modules/audio_filter/resampler/speex.c
@@ -111,7 +111,7 @@ static block_t *Resample (filter_t *filter, block_t *in)
     const unsigned orate = filter->fmt_out.audio.i_rate;
 
     spx_uint32_t ilen = in->i_nb_samples;
-    spx_uint32_t olen = ((ilen + 2) * orate) / irate;
+    spx_uint32_t olen = ((ilen + 2) * orate * 11) / (irate * 10);
 
     block_t *out = block_Alloc (olen * framesize);
     if (unlikely(out == NULL))

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to