summaryrefslogtreecommitdiff
path: root/rtp.c
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2005-04-03 22:57:18 +0000
committerKevin P. Fleming <kpfleming@digium.com>2005-04-03 22:57:18 +0000
commitb96ae79baacf4012d524638c34f5eea97be426e5 (patch)
tree0377d7238fbc8640a0885f84f0b381aaef09d78c /rtp.c
parent7e3e619497db5bf939c16009e7a1e69d372d01a6 (diff)
handle AST_FORMAT_SLINEAR endianness properly on big-endian systems (bug #3865)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5373 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'rtp.c')
-rwxr-xr-xrtp.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/rtp.c b/rtp.c
index cfcfc1c3d..22840eb3c 100755
--- a/rtp.c
+++ b/rtp.c
@@ -596,6 +596,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
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);
@@ -1320,6 +1321,19 @@ int ast_rtp_write(struct ast_rtp *rtp, struct ast_frame *_f)
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) {