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

Tristan Matthews git at videolan.org
Mon Apr 21 17:13:53 CEST 2014


vlc | branch: master | Tristan Matthews <le.businessman at gmail.com> | Mon Apr 21 00:29:54 2014 -0400| [08feb323f481d9fbfa914fea1d48d09581d8475e] | committer: Tristan Matthews

speex: deduce mode from rate when decoding rtp

Fixes #5178

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

 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 f366055..90d773a 100644
--- a/modules/codec/speex.c
+++ b/modules/codec/speex.c
@@ -650,9 +650,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." );



More information about the vlc-commits mailing list