[vlc-devel] [PATCH] speex: deduce mode from rate when decoding rtp

Tristan Matthews le.businessman at gmail.com
Mon Apr 21 06:32:16 CEST 2014


Fixes #5178
---
 modules/codec/speex.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/codec/speex.c b/modules/codec/speex.c
index 488b9c2..b840082 100644
--- a/modules/codec/speex.c
+++ b/modules/codec/speex.c
@@ -582,9 +582,12 @@ static block_t *DecodeRtpSpeexPacket( decoder_t *p_dec, block_t **pp_block )
             msg_Err( p_dec, "Could not allocate a Speex header.");
             return NULL;
         }
-        speex_init_header( p_sys->p_header,p_sys->rtp_rate,1,&speex_nb_mode );
+
+        const SpeexMode *mode = speex_lib_get_mode((p_sys->rtp_rate / 8000) >> 1);
+
+        speex_init_header( p_sys->p_header,p_sys->rtp_rate, 1, mode );
             speex_bits_init( &p_sys->bits );
-        p_sys->p_state = speex_decoder_init( &speex_nb_mode );
+        p_sys->p_state = speex_decoder_init( mode );
         if ( !p_sys->p_state )
         {
             msg_Err( p_dec, "Could not allocate a Speex decoder." );
-- 
1.9.1




More information about the vlc-devel mailing list