From 69399315991bf7f9679e2d9b22f42415653cfc04 Mon Sep 17 00:00:00 2001 From: markster Date: Fri, 29 Nov 2002 02:14:13 +0000 Subject: Version 0.3.0 from FTP git-svn-id: http://svn.digium.com/svn/asterisk/trunk@556 f38db490-d61c-443f-a65b-d21fe96a405b --- codecs/codec_lpc10.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'codecs/codec_lpc10.c') 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; -- cgit v1.2.3