- Fix the last set of places where incorrect assumptions were made about the

sample length with g722.  It is _2_ samples per byte, not 1.  This was all
   over the place, and I believed it, and it is what caused me to take so long
   to figure out what was broken.
 - Update copyright information on codec_g722.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@98081 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Russell Bryant 18 years ago
parent e1e186471f
commit 9387f036d8

@ -1,9 +1,10 @@
/* /*
* Asterisk -- An open source telephony toolkit. * Asterisk -- An open source telephony toolkit.
* *
* Copyright (C) 1999 - 2006, Digium, Inc. * Copyright (C) 1999 - 2008, Digium, Inc.
* *
* Matthew Fredrickson <creslin@digium.com> * Matthew Fredrickson <creslin@digium.com>
* Russell Bryant <russell@digium.com>
* *
* Special thanks to Steve Underwood for the implementation * Special thanks to Steve Underwood for the implementation
* and for doing the 8khz<->g.722 direct translation code. * and for doing the 8khz<->g.722 direct translation code.
@ -23,6 +24,9 @@
* *
* \brief codec_g722.c - translate between signed linear and ITU G.722-64kbps * \brief codec_g722.c - translate between signed linear and ITU G.722-64kbps
* *
* \author Matthew Fredrickson <creslin@digium.com>
* \author Russell Bryant <russell@digium.com>
*
* \arg http://soft-switch.org/downloads/non-gpl-bits.tgz * \arg http://soft-switch.org/downloads/non-gpl-bits.tgz
* \arg http://lists.digium.com/pipermail/asterisk-dev/2006-September/022866.html * \arg http://lists.digium.com/pipermail/asterisk-dev/2006-September/022866.html
* *
@ -162,7 +166,7 @@ static struct ast_frame *g722tolin_sample(void)
.frametype = AST_FRAME_VOICE, .frametype = AST_FRAME_VOICE,
.subclass = AST_FORMAT_G722, .subclass = AST_FORMAT_G722,
.datalen = sizeof(g722_slin_ex), .datalen = sizeof(g722_slin_ex),
.samples = sizeof(g722_slin_ex), .samples = sizeof(g722_slin_ex) * 2,
.src = __PRETTY_FUNCTION__, .src = __PRETTY_FUNCTION__,
.data = g722_slin_ex, .data = g722_slin_ex,
}; };
@ -176,7 +180,7 @@ static struct ast_frame *g722tolin16_sample(void)
.frametype = AST_FRAME_VOICE, .frametype = AST_FRAME_VOICE,
.subclass = AST_FORMAT_G722, .subclass = AST_FORMAT_G722,
.datalen = sizeof(slin_g722_ex), .datalen = sizeof(slin_g722_ex),
.samples = sizeof(slin_g722_ex), .samples = sizeof(slin_g722_ex) * 2,
.src = __PRETTY_FUNCTION__, .src = __PRETTY_FUNCTION__,
.data = slin_g722_ex, .data = slin_g722_ex,
}; };
@ -233,7 +237,7 @@ static struct ast_translator lintog722 = {
.framein = lintog722_framein, .framein = lintog722_framein,
.sample = lintog722_sample, .sample = lintog722_sample,
.desc_size = sizeof(struct g722_encoder_pvt), .desc_size = sizeof(struct g722_encoder_pvt),
.buffer_samples = BUFFER_SAMPLES, .buffer_samples = BUFFER_SAMPLES * 2,
.buf_size = BUFFER_SAMPLES, .buf_size = BUFFER_SAMPLES,
}; };
@ -258,7 +262,7 @@ static struct ast_translator lin16tog722 = {
.framein = lin16tog722_framein, .framein = lin16tog722_framein,
.sample = lin16tog722_sample, .sample = lin16tog722_sample,
.desc_size = sizeof(struct g722_encoder_pvt), .desc_size = sizeof(struct g722_encoder_pvt),
.buffer_samples = BUFFER_SAMPLES, .buffer_samples = BUFFER_SAMPLES * 2,
.buf_size = BUFFER_SAMPLES, .buf_size = BUFFER_SAMPLES,
}; };

@ -1372,9 +1372,9 @@ int ast_codec_get_samples(struct ast_frame *f)
break; break;
case AST_FORMAT_ULAW: case AST_FORMAT_ULAW:
case AST_FORMAT_ALAW: case AST_FORMAT_ALAW:
case AST_FORMAT_G722:
samples = f->datalen; samples = f->datalen;
break; break;
case AST_FORMAT_G722:
case AST_FORMAT_ADPCM: case AST_FORMAT_ADPCM:
case AST_FORMAT_G726: case AST_FORMAT_G726:
case AST_FORMAT_G726_AAL2: case AST_FORMAT_G726_AAL2:
@ -1410,9 +1410,9 @@ int ast_codec_get_len(int format, int samples)
break; break;
case AST_FORMAT_ULAW: case AST_FORMAT_ULAW:
case AST_FORMAT_ALAW: case AST_FORMAT_ALAW:
case AST_FORMAT_G722:
len = samples; len = samples;
break; break;
case AST_FORMAT_G722:
case AST_FORMAT_ADPCM: case AST_FORMAT_ADPCM:
case AST_FORMAT_G726: case AST_FORMAT_G726:
case AST_FORMAT_G726_AAL2: case AST_FORMAT_G726_AAL2:

Loading…
Cancel
Save