[vlc-devel] [PATCH] speex: don't run if we don't need resampling

Rafaël Carré funman at videolan.org
Sun Jan 22 21:16:25 CET 2012


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

diff --git a/modules/audio_filter/resampler/speex.c b/modules/audio_filter/resampler/speex.c
index cc00e86..c642a49 100644
--- a/modules/audio_filter/resampler/speex.c
+++ b/modules/audio_filter/resampler/speex.c
@@ -104,6 +104,10 @@ static void Close (vlc_object_t *obj)
 
 static block_t *Resample (filter_t *filter, block_t *in)
 {
+    /* Check if we really need to run the resampler */
+    if( filter->fmt_out.audio.i_rate == filter->fmt_in.audio.i_rate )
+        return in;
+
     SpeexResamplerState *st = (SpeexResamplerState *)filter->p_sys;
 
     const size_t framesize = filter->fmt_out.audio.i_bytes_per_frame;
-- 
1.7.8.3



More information about the vlc-devel mailing list