Index: codec_speex.c =================================================================== --- codec_speex.c (revision 21231) +++ codec_speex.c (working copy) @@ -99,13 +99,23 @@ }; +static int entries = 0; + static void *lintospeex_new(struct ast_trans_pvt *pvt) { + struct speex_coder_pvt *tmp = pvt->pvt; +// Crude hack to prevent creating new speex encoders + + if(entries++ > 2) { + ast_log(LOG_WARNING, "crude entries is %d\n", entries); + return NULL; + } + if (!(tmp->speex = speex_encoder_init(&speex_nb_mode))) return NULL; - + speex_bits_init(&tmp->bits); speex_bits_reset(&tmp->bits); speex_encoder_ctl(tmp->speex, SPEEX_GET_FRAME_SIZE, &tmp->framesize); @@ -321,7 +331,6 @@ static void speextolin_destroy(struct ast_trans_pvt *arg) { struct speex_coder_pvt *pvt = arg->pvt; - speex_decoder_destroy(pvt->speex); speex_bits_destroy(&pvt->bits); } @@ -335,6 +344,8 @@ #endif speex_encoder_destroy(pvt->speex); speex_bits_destroy(&pvt->bits); + entries--; + ast_log(LOG_WARNING, "destroying lintospeex %d\n", entries); } static struct ast_translator speextolin = {