Index: codec_speex.c =================================================================== RCS file: /usr/cvsroot/asterisk/codecs/codec_speex.c,v retrieving revision 1.6 diff -u -r1.6 codec_speex.c --- codec_speex.c 22 Jun 2004 18:49:00 -0000 1.6 +++ codec_speex.c 24 Aug 2004 06:07:52 -0000 @@ -151,22 +151,19 @@ int x; int res; float fout[1024]; + /* Read in bits */ speex_bits_read_from(&tmp->bits, f->data, f->datalen); - for(;;) { - res = speex_decode(tmp->speex, &tmp->bits, fout); - if (res < 0) - break; - if (tmp->tail + tmp->framesize < sizeof(tmp->buf) / 2) { - for (x=0;xframesize;x++) { - tmp->buf[tmp->tail + x] = fout[x]; - } - tmp->tail += tmp->framesize; - } else { - ast_log(LOG_WARNING, "Out of buffer space\n"); - return -1; - } - + res = speex_decode(tmp->speex, &tmp->bits, fout); + if (res < 0) + return 0; + if (tmp->tail + tmp->framesize < sizeof(tmp->buf) / 2) { + for (x=0;xframesize;x++) + tmp->buf[tmp->tail + x] = fout[x]; + tmp->tail += tmp->framesize; + } else { + ast_log(LOG_WARNING, "Out of buffer space\n"); + return -1; } return 0; }