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
This commit is contained in:
Kevin P. Fleming
2005-04-03 22:57:18 +00:00
parent 7e3e619497
commit b96ae79baa
6 changed files with 80 additions and 11 deletions

View File

@@ -855,8 +855,15 @@ void iax_frame_wrap(struct iax_frame *fr, struct ast_frame *f)
fr->af.delivery.tv_sec = 0;
fr->af.delivery.tv_usec = 0;
fr->af.data = fr->afdata;
if (fr->af.datalen)
if (fr->af.datalen) {
#if __BYTE_ORDER == __LITTLE_ENDIAN
/* We need to byte-swap slinear samples from network byte order */
if (fr->af.subclass == AST_FORMAT_SLINEAR) {
ast_memcpy_byteswap(fr->af.data, f->data, fr->af.samples);
} else
#endif
memcpy(fr->af.data, f->data, fr->af.datalen);
}
}
struct iax_frame *iax_frame_new(int direction, int datalen)