[asterisk-commits] russell: trunk r98081 - in /trunk: codecs/codec_g722.c main/frame.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 10 21:37:20 CST 2008


Author: russell
Date: Thu Jan 10 21:37:19 2008
New Revision: 98081

URL: http://svn.digium.com/view/asterisk?view=rev&rev=98081
Log:
 - 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.

Modified:
    trunk/codecs/codec_g722.c
    trunk/main/frame.c

Modified: trunk/codecs/codec_g722.c
URL: http://svn.digium.com/view/asterisk/trunk/codecs/codec_g722.c?view=diff&rev=98081&r1=98080&r2=98081
==============================================================================
--- trunk/codecs/codec_g722.c (original)
+++ trunk/codecs/codec_g722.c Thu Jan 10 21:37:19 2008
@@ -1,9 +1,10 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (C) 1999 - 2006, Digium, Inc.
+ * Copyright (C) 1999 - 2008, Digium, Inc.
  *
  * Matthew Fredrickson <creslin at digium.com>
+ * Russell Bryant <russell at digium.com>
  *
  * Special thanks to Steve Underwood for the implementation
  * 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
  *
+ * \author Matthew Fredrickson <creslin at digium.com>
+ * \author Russell Bryant <russell at digium.com>
+ *
  * \arg http://soft-switch.org/downloads/non-gpl-bits.tgz
  * \arg http://lists.digium.com/pipermail/asterisk-dev/2006-September/022866.html
  *
@@ -162,7 +166,7 @@
 		.frametype = AST_FRAME_VOICE,
 		.subclass = AST_FORMAT_G722,
 		.datalen = sizeof(g722_slin_ex),
-		.samples = sizeof(g722_slin_ex),
+		.samples = sizeof(g722_slin_ex) * 2,
 		.src = __PRETTY_FUNCTION__,
 		.data = g722_slin_ex,
 	};
@@ -176,7 +180,7 @@
 		.frametype = AST_FRAME_VOICE,
 		.subclass = AST_FORMAT_G722,
 		.datalen = sizeof(slin_g722_ex),
-		.samples = sizeof(slin_g722_ex),
+		.samples = sizeof(slin_g722_ex) * 2,
 		.src = __PRETTY_FUNCTION__,
 		.data = slin_g722_ex,
 	};
@@ -233,7 +237,7 @@
 	.framein = lintog722_framein,
 	.sample = lintog722_sample,
 	.desc_size = sizeof(struct g722_encoder_pvt),
-	.buffer_samples = BUFFER_SAMPLES,
+	.buffer_samples = BUFFER_SAMPLES * 2,
 	.buf_size = BUFFER_SAMPLES,
 };
 
@@ -258,7 +262,7 @@
 	.framein = lin16tog722_framein,
 	.sample = lin16tog722_sample,
 	.desc_size = sizeof(struct g722_encoder_pvt),
-	.buffer_samples = BUFFER_SAMPLES,
+	.buffer_samples = BUFFER_SAMPLES * 2,
 	.buf_size = BUFFER_SAMPLES,
 };
 

Modified: trunk/main/frame.c
URL: http://svn.digium.com/view/asterisk/trunk/main/frame.c?view=diff&rev=98081&r1=98080&r2=98081
==============================================================================
--- trunk/main/frame.c (original)
+++ trunk/main/frame.c Thu Jan 10 21:37:19 2008
@@ -1372,9 +1372,9 @@
 		break;
 	case AST_FORMAT_ULAW:
 	case AST_FORMAT_ALAW:
+		samples = f->datalen;
+		break;
 	case AST_FORMAT_G722:
-		samples = f->datalen;
-		break;
 	case AST_FORMAT_ADPCM:
 	case AST_FORMAT_G726:
 	case AST_FORMAT_G726_AAL2:
@@ -1410,9 +1410,9 @@
 		break;
 	case AST_FORMAT_ULAW:
 	case AST_FORMAT_ALAW:
+		len = samples;
+		break;
 	case AST_FORMAT_G722:
-		len = samples;
-		break;
 	case AST_FORMAT_ADPCM:
 	case AST_FORMAT_G726:
 	case AST_FORMAT_G726_AAL2:




More information about the asterisk-commits mailing list