[xiph-commits] r13175 - branches/speex-branches/speex-1.0-branch/src

jm at svn.xiph.org jm at svn.xiph.org
Fri Jun 22 21:08:03 PDT 2007


Author: jm
Date: 2007-06-22 21:08:03 -0700 (Fri, 22 Jun 2007)
New Revision: 13175

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



Modified: branches/speex-branches/speex-1.0-branch/src/speexenc.c
===================================================================
--- branches/speex-branches/speex-1.0-branch/src/speexenc.c	2007-06-23 03:57:58 UTC (rev 13174)
+++ branches/speex-branches/speex-1.0-branch/src/speexenc.c	2007-06-23 04:08:03 UTC (rev 13175)
@@ -458,6 +458,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);
@@ -517,7 +518,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