[Asterisk-cvs] asterisk ChangeLog, 1.74.2.39, 1.74.2.40 frame.c,
1.36.2.4, 1.36.2.5 rtp.c, 1.92.2.9, 1.92.2.10
russell at lists.digium.com
russell at lists.digium.com
Tue Apr 5 02:17:18 CDT 2005
Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv5421
Modified Files:
Tag: v1-0
ChangeLog frame.c rtp.c
Log Message:
handle AST_FORMAT_SLINEAR endianness properly on big-endian systems (bug #3865)
Index: ChangeLog
===================================================================
RCS file: /usr/cvsroot/asterisk/ChangeLog,v
retrieving revision 1.74.2.39
retrieving revision 1.74.2.40
diff -u -d -r1.74.2.39 -r1.74.2.40
--- ChangeLog 5 Apr 2005 06:58:02 -0000 1.74.2.39
+++ ChangeLog 5 Apr 2005 07:10:06 -0000 1.74.2.40
@@ -27,6 +27,8 @@
a new line, it would not be processed
-- Fixed the logger so that color escape sequences wouldn't be sent to the logs
-- Fixed a logic error when setting the "rtpchecksums" option
+ -- A lot of changes were made to correctly handle signed linear format on
+ big endian machines
Asterisk 1.0.7
Index: frame.c
===================================================================
RCS file: /usr/cvsroot/asterisk/frame.c,v
retrieving revision 1.36.2.4
retrieving revision 1.36.2.5
diff -u -d -r1.36.2.4 -r1.36.2.5
--- frame.c 28 Jan 2005 01:18:25 -0000 1.36.2.4
+++ frame.c 5 Apr 2005 07:10:06 -0000 1.36.2.5
@@ -83,7 +83,7 @@
s->flags = flags;
}
-int ast_smoother_feed(struct ast_smoother *s, struct ast_frame *f)
+int __ast_smoother_feed(struct ast_smoother *s, struct ast_frame *f, int swap)
{
if (f->frametype != AST_FRAME_VOICE) {
ast_log(LOG_WARNING, "Huh? Can't smooth a non-voice frame!\n");
@@ -129,7 +129,10 @@
return 0;
}
}
- memcpy(s->data + s->len, f->data, f->datalen);
+ if (swap)
+ ast_memcpy_byteswap(s->data+s->len, f->data, f->samples);
+ else
+ memcpy(s->data + s->len, f->data, f->datalen);
/* If either side is empty, reset the delivery time */
if (!s->len || (!f->delivery.tv_sec && !f->delivery.tv_usec) ||
(!s->delivery.tv_sec && !s->delivery.tv_usec))
@@ -399,6 +402,16 @@
return ast_fr_fdwrite(fd, &hangup);
}
+void ast_memcpy_byteswap(void *dst, void *src, int samples)
+{
+ int i;
+ unsigned short *dst_s = dst;
+ unsigned short *src_s = src;
+
+ for (i=0; i<samples; i++)
+ dst_s[i] = (src_s[i]<<8)|(src_s[i]>>8);
+}
+
static struct ast_format_list AST_FORMAT_LIST[] = {
{ 1, AST_FORMAT_G723_1 , "g723" , "G.723.1"},
{ 1, AST_FORMAT_GSM, "gsm" , "GSM"},
Index: rtp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/rtp.c,v
retrieving revision 1.92.2.9
retrieving revision 1.92.2.10
diff -u -d -r1.92.2.9 -r1.92.2.10
--- rtp.c 5 Apr 2005 06:53:14 -0000 1.92.2.9
+++ rtp.c 5 Apr 2005 07:10:06 -0000 1.92.2.10
@@ -547,6 +547,7 @@
break;
case AST_FORMAT_SLINEAR:
rtp->f.samples = rtp->f.datalen / 2;
+ ast_frame_byteswap_be(&rtp->f);
break;
case AST_FORMAT_GSM:
rtp->f.samples = 160 * (rtp->f.datalen / 33);
@@ -1196,6 +1197,19 @@
switch(subclass) {
+ case AST_FORMAT_SLINEAR:
+ if (!rtp->smoother) {
+ rtp->smoother = ast_smoother_new(320);
+ }
+ if (!rtp->smoother) {
+ ast_log(LOG_WARNING, "Unable to create smoother :(\n");
+ return -1;
+ }
+ ast_smoother_feed_be(rtp->smoother, _f);
+
+ while((f = ast_smoother_read(rtp->smoother)))
+ ast_rtp_raw_write(rtp, f, codec);
+ break;
case AST_FORMAT_ULAW:
case AST_FORMAT_ALAW:
if (!rtp->smoother) {
More information about the svn-commits
mailing list