[Asterisk-cvs] asterisk rtp.c,1.48,1.49

markster at lists.digium.com markster at lists.digium.com
Tue Feb 24 23:21:51 CST 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv30623

Modified Files:
	rtp.c 
Log Message:
Add G.726-32kbps Codec Transcoder (Tested with Cisco ATA-186)


Index: rtp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/rtp.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- rtp.c	18 Feb 2004 21:38:46 -0000	1.48
+++ rtp.c	25 Feb 2004 04:10:32 -0000	1.49
@@ -468,6 +468,7 @@
 			rtp->f.samples = 240 * (rtp->f.datalen / 50);
 			break;
 		case AST_FORMAT_ADPCM:
+		case AST_FORMAT_G726:
 			rtp->f.samples = rtp->f.datalen * 2;
 			break;
 		case AST_FORMAT_G729A:
@@ -912,7 +913,13 @@
 		case AST_FORMAT_ALAW:
 			/* If we're within +/- 20ms from when where we
 			   predict we should be, use that */
-			pred = rtp->lastts + f->datalen;
+			pred = rtp->lastts + f->datalen * 2;
+			break;
+		case AST_FORMAT_ADPCM:
+		case AST_FORMAT_G726:
+			/* If we're within +/- 20ms from when where we
+			   predict we should be, use that */
+			pred = rtp->lastts + f->datalen * 2;
 			break;
 		case AST_FORMAT_G729A:
 			pred = rtp->lastts + f->datalen * 8;
@@ -1018,6 +1025,19 @@
 	case AST_FORMAT_ALAW:
 		if (!rtp->smoother) {
 			rtp->smoother = ast_smoother_new(160);
+		}
+		if (!rtp->smoother) {
+			ast_log(LOG_WARNING, "Unable to create smoother :(\n");
+			return -1;
+		}
+		ast_smoother_feed(rtp->smoother, _f);
+		
+		while((f = ast_smoother_read(rtp->smoother)))
+			ast_rtp_raw_write(rtp, f, codec);
+		break;
+	case AST_FORMAT_G726:
+		if (!rtp->smoother) {
+			rtp->smoother = ast_smoother_new(80);
 		}
 		if (!rtp->smoother) {
 			ast_log(LOG_WARNING, "Unable to create smoother :(\n");




More information about the svn-commits mailing list