aboutsummaryrefslogtreecommitdiffstats
path: root/codecs/codec_gsm.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>1999-12-12 08:49:19 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>1999-12-12 08:49:19 +0000
commit62474f51d097308f1efd34af6be1902e7aac4b81 (patch)
tree91595c2babd8f2df982aaf130ce18ccd8b6b7381 /codecs/codec_gsm.c
parent201849f9224ef840d3701ae6e92f3b71ab63f47b (diff)
Version 0.1.1 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@135 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'codecs/codec_gsm.c')
-rwxr-xr-xcodecs/codec_gsm.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/codecs/codec_gsm.c b/codecs/codec_gsm.c
index 05ef8d657..169371230 100755
--- a/codecs/codec_gsm.c
+++ b/codecs/codec_gsm.c
@@ -6,7 +6,7 @@
* The GSM code is from TOAST. Copyright information for that package is available
* in the GSM directory.
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
@@ -65,6 +65,7 @@ static struct ast_translator_pvt *gsm_new()
tmp = NULL;
}
tmp->tail = 0;
+ localusecnt++;
}
return tmp;
}
@@ -90,8 +91,8 @@ static struct ast_frame *gsmtolin_sample()
f.frametype = AST_FRAME_VOICE;
f.subclass = AST_FORMAT_GSM;
f.datalen = sizeof(gsm_slin_ex);
- /* All frames are 30 ms long */
- f.timelen = 30;
+ /* All frames are 20 ms long */
+ f.timelen = 20;
f.mallocd = 0;
f.offset = 0;
f.src = __PRETTY_FUNCTION__;
@@ -156,7 +157,7 @@ static int lintogsm_framein(struct ast_translator_pvt *tmp, struct ast_frame *f)
is too old, then we should overwrite it entirely, otherwise we can
get artifacts of earlier talk that do not belong */
if (tmp->tail + f->datalen < sizeof(tmp->buf) / 2) {
- memcpy(tmp->buf + tmp->tail, f->data, f->datalen);
+ memcpy((tmp->buf + tmp->tail), f->data, f->datalen);
tmp->tail += f->datalen/2;
} else {
ast_log(LOG_WARNING, "Out of buffer space\n");
@@ -184,7 +185,7 @@ static struct ast_frame *lintogsm_frameout(struct ast_translator_pvt *tmp)
tmp->tail -= 160;
/* Move the data at the end of the buffer to the front */
if (tmp->tail)
- memmove(tmp->buf, tmp->buf + 160 * 2, tmp->tail * 2);
+ memmove(tmp->buf, tmp->buf + 160, tmp->tail * 2);
#if 0
/* Save a sample frame */
{ static int samplefr = 0;
@@ -203,6 +204,7 @@ static struct ast_frame *lintogsm_frameout(struct ast_translator_pvt *tmp)
static void gsm_destroy_stuff(struct ast_translator_pvt *pvt)
{
free(pvt);
+ localusecnt--;
}
static struct ast_translator gsmtolin =