1 Index: asterisk11-chan-dongle-1.1r35/channel.c
2 ===================================================================
3 --- asterisk11-chan-dongle-1.1r35.orig/channel.c
4 +++ asterisk11-chan-dongle-1.1r35/channel.c
5 @@ -495,6 +495,19 @@ again:
9 +// see https://github.com/openwrt/telephony/issues/7
10 +static inline void change_audio_endianness_to_le(struct iovec *iov, int iovcnt)
12 +#if __BYTE_ORDER == __LITTLE_ENDIAN
13 + return; // nothing to do
15 + for(;iovcnt-->0;iov++)
17 + ast_swapcopy_samples(iov->iov_base, iov->iov_base, iov->iov_len/2);
23 static void timing_write (struct pvt* pvt)
25 @@ -522,6 +535,7 @@ static void timing_write (struct pvt* pv
26 iovcnt = mixb_read_n_iov (&pvt->a_write_mixb, iov, FRAME_SIZE);
27 mixb_read_n_iov (&pvt->a_write_mixb, iov, FRAME_SIZE);
28 mixb_read_upd (&pvt->a_write_mixb, FRAME_SIZE);
29 + change_audio_endianness_to_le(iov, iovcnt);
33 @@ -535,6 +549,7 @@ static void timing_write (struct pvt* pv
34 iov[iovcnt].iov_base = silence_frame;
35 iov[iovcnt].iov_len = FRAME_SIZE - used;
37 + change_audio_endianness_to_le(iov, iovcnt);
41 @@ -544,6 +559,7 @@ static void timing_write (struct pvt* pv
42 iov[0].iov_base = silence_frame;
43 iov[0].iov_len = FRAME_SIZE;
45 + // ignore endianness for zeros