[xiph-commits] r10803 - trunk/speex/src

jm at svn.xiph.org jm at svn.xiph.org
Sun Feb 12 03:03:32 PST 2006


Author: jm
Date: 2006-02-12 03:03:30 -0800 (Sun, 12 Feb 2006)
New Revision: 10803

Modified:
   trunk/speex/src/speexenc.c
Log:
Think I fixed a crash when trying to encode in the wrong mode


Modified: trunk/speex/src/speexenc.c
===================================================================
--- trunk/speex/src/speexenc.c	2006-02-12 10:40:21 UTC (rev 10802)
+++ trunk/speex/src/speexenc.c	2006-02-12 11:03:30 UTC (rev 10803)
@@ -477,6 +477,7 @@
       rate=8000;
    } else if (modeID!=-1 && rate)
    {
+      mode = speex_lib_get_mode (modeID);
       if (rate>48000)
       {
          fprintf (stderr, "Error: sampling rate too high: %d Hz, try down-sampling\n", rate);
@@ -536,7 +537,8 @@
       if (rate!=8000 && rate!=16000 && rate!=32000)
          fprintf (stderr, "Warning: Speex is only optimized for 8, 16 and 32 kHz. It will still work at %d Hz but your mileage may vary\n", rate); 
 
-   mode = speex_lib_get_mode (modeID);
+   if (!mode)
+      mode = speex_lib_get_mode (modeID);
 
    speex_init_header(&header, rate, 1, mode);
    header.frames_per_packet=nframes;



More information about the commits mailing list