diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-04-05 07:10:06 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-04-05 07:10:06 +0000 |
commit | 94b3c595a50c02e54a2013f55b1efea76653ef1d (patch) | |
tree | 62fa2d544a4c32b0faae4aa48564d962fd55a50a /rtp.c | |
parent | 0f4f47924e0382b25bc9b6daf916c2fff9990a1a (diff) |
handle AST_FORMAT_SLINEAR endianness properly on big-endian systems (bug #3865)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/v1-0@5399 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'rtp.c')
-rwxr-xr-x | rtp.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -547,6 +547,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); @@ -1196,6 +1197,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) { |