aboutsummaryrefslogtreecommitdiffstats
path: root/codecs/codec_speex.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-03-17 21:30:19 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-03-17 21:30:19 +0000
commit235a6486c3ca01b9bdac577774cc90fa4f06a58f (patch)
tree2ff53ca559c15101655e44ad4281225c8aae6685 /codecs/codec_speex.c
parent98aa637d27b5ac36a35fc85b596f00d1104398e3 (diff)
Add PLC and jitter buffer and iax2 meta trunk with timestamps (bug #2532, #3400)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5192 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'codecs/codec_speex.c')
-rwxr-xr-xcodecs/codec_speex.c20
1 files changed, 18 insertions, 2 deletions
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;x<tmp->framesize;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;