aboutsummaryrefslogtreecommitdiffstats
path: root/codecs/codec_lpc10.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2002-11-29 02:14:13 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2002-11-29 02:14:13 +0000
commit69399315991bf7f9679e2d9b22f42415653cfc04 (patch)
treee3349bbc37c69394a11f4358e9af9f7a5d2a2329 /codecs/codec_lpc10.c
parent2d459a804c0512bbceafe63a934770c2aa3f5edd (diff)
Version 0.3.0 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@556 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'codecs/codec_lpc10.c')
-rwxr-xr-xcodecs/codec_lpc10.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/codecs/codec_lpc10.c b/codecs/codec_lpc10.c
index a2f6bd911..3ee94326c 100755
--- a/codecs/codec_lpc10.c
+++ b/codecs/codec_lpc10.c
@@ -100,14 +100,11 @@ static struct ast_translator_pvt *lpc10_dec_new()
static struct ast_frame *lintolpc10_sample()
{
static struct ast_frame f;
- static int longer = 0;
f.frametype = AST_FRAME_VOICE;
f.subclass = AST_FORMAT_SLINEAR;
f.datalen = sizeof(slin_lpc10_ex);
/* Assume 8000 Hz */
- f.timelen = LPC10_SAMPLES_PER_FRAME/8;
- f.timelen += longer;
- longer = 1- longer;
+ f.samples = LPC10_SAMPLES_PER_FRAME;
f.mallocd = 0;
f.offset = 0;
f.src = __PRETTY_FUNCTION__;
@@ -123,7 +120,7 @@ static struct ast_frame *lpc10tolin_sample()
f.datalen = sizeof(lpc10_slin_ex);
/* All frames are 22 ms long (maybe a little more -- why did he choose
LPC10_SAMPLES_PER_FRAME sample frames anyway?? */
- f.timelen = LPC10_SAMPLES_PER_FRAME/8;
+ f.samples = LPC10_SAMPLES_PER_FRAME;
f.mallocd = 0;
f.offset = 0;
f.src = __PRETTY_FUNCTION__;
@@ -141,7 +138,7 @@ static struct ast_frame *lpc10tolin_frameout(struct ast_translator_pvt *tmp)
tmp->f.subclass = AST_FORMAT_SLINEAR;
tmp->f.datalen = tmp->tail * 2;
/* Assume 8000 Hz */
- tmp->f.timelen = tmp->tail / 8;
+ tmp->f.samples = tmp->tail;
tmp->f.mallocd = 0;
tmp->f.offset = AST_FRIENDLY_OFFSET;
tmp->f.src = __PRETTY_FUNCTION__;
@@ -254,7 +251,7 @@ static struct ast_frame *lintolpc10_frameout(struct ast_translator_pvt *tmp)
if (tmp->tail < LPC10_SAMPLES_PER_FRAME)
return NULL;
/* Start with an empty frame */
- tmp->f.timelen = 0;
+ tmp->f.samples = 0;
tmp->f.datalen = 0;
tmp->f.frametype = AST_FRAME_VOICE;
tmp->f.subclass = AST_FORMAT_LPC10;
@@ -270,9 +267,7 @@ static struct ast_frame *lintolpc10_frameout(struct ast_translator_pvt *tmp)
lpc10_encode(tmpbuf, bits, tmp->lpc10.enc);
build_bits(((unsigned char *)tmp->outbuf) + tmp->f.datalen, bits);
tmp->f.datalen += LPC10_BYTES_IN_COMPRESSED_FRAME;
- tmp->f.timelen += 22;
- /* We alternate between 22 and 23 ms to simulate 22.5 ms */
- tmp->f.timelen += tmp->longer;
+ tmp->f.samples += LPC10_SAMPLES_PER_FRAME;
/* Use one of the two left over bits to record if this is a 22 or 23 ms frame...
important for IAX use */
tmp->longer = 1 - tmp->longer;