From 7082d0584eb61abbc7c8055b74d9a7955046a8ef Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Thu, 17 Mar 2005 21:30:19 +0000 Subject: Add PLC and jitter buffer and iax2 meta trunk with timestamps (bug #2532, #3400) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5192 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- codecs/codec_speex.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'codecs/codec_speex.c') diff --git a/codecs/codec_speex.c b/codecs/codec_speex.c index 0f7bdd6c7..d59a849b4 100755 --- a/codecs/codec_speex.c +++ b/codecs/codec_speex.c @@ -181,6 +181,21 @@ static int speextolin_framein(struct ast_translator_pvt *tmp, struct ast_frame * int x; int res; float fout[1024]; + + if(f->datalen == 0) { /* Native PLC interpolation */ + if(tmp->tail + tmp->framesize > sizeof(tmp->buf) / 2) { + ast_log(LOG_WARNING, "Out of buffer space\n"); + return -1; + } + speex_decode(tmp->speex, NULL, fout); + for (x=0;xframesize;x++) { + tmp->buf[tmp->tail + x] = fout[x]; + } + tmp->tail += tmp->framesize; + return 0; + } + + /* Read in bits */ speex_bits_read_from(&tmp->bits, f->data, f->datalen); for(;;) { @@ -357,11 +372,12 @@ static void parse_config(void) ast_mutex_unlock(&localuser_lock); } else if (!strcasecmp(var->name, "abr")) { res = abs(atoi(var->value)); - if (option_verbose > 2) + if (option_verbose > 2) { if(res > 0) ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Setting ABR target bitrate to %d\n",res); else - ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Disabling ABR\n",res); + ast_verbose(VERBOSE_PREFIX_3 "CODEC SPEEX: Disabling ABR\n"); + } if (res >= 0) { ast_mutex_lock(&localuser_lock); abr = res; -- cgit v1.2.3