Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xiph/speex.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>2007-06-23 08:08:03 +0400
committerjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>2007-06-23 08:08:03 +0400
commitdbe8ba33f33574aed72d3cbbf12163f9bdfb1071 (patch)
treedcf177085a88b53c10ee5ac5b023de29e57ce37e
parent176908c4e3e86eb171a68ca20e99594642be9939 (diff)
Think I fixed a crash when trying to encode in the wrong mode
git-svn-id: http://svn.xiph.org/branches/speex-branches/speex-1.0-branch@13175 0101bb08-14d6-0310-b084-bc0e0c8e3800
-rw-r--r--src/speexenc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/speexenc.c b/src/speexenc.c
index d36700a..ab5ad31 100644
--- a/src/speexenc.c
+++ b/src/speexenc.c
@@ -458,6 +458,7 @@ int main(int argc, char **argv)
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 @@ int main(int argc, char **argv)
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;