asterisk-13.x: mark chan-lantiq as nonshared
[feed/telephony.git] / net / asterisk-chan-dongle / patches / 100-fix-audio-on-big-endian-systems.patch
1 --- a/channel.c
2 +++ b/channel.c
3 @@ -539,6 +539,19 @@ again:
4 }
5 }
6
7 +// see https://github.com/openwrt/telephony/issues/7
8 +static inline void change_audio_endianness_to_le(struct iovec *iov, int iovcnt)
9 +{
10 +#if __BYTE_ORDER == __LITTLE_ENDIAN
11 + return; // nothing to do
12 +#else
13 + for(;iovcnt-->0;iov++)
14 + {
15 + ast_swapcopy_samples(iov->iov_base, iov->iov_base, iov->iov_len/2);
16 + }
17 +#endif
18 +}
19 +
20 #/* */
21 static void timing_write (struct pvt* pvt)
22 {
23 @@ -566,6 +579,7 @@ static void timing_write (struct pvt* pv
24 iovcnt = mixb_read_n_iov (&pvt->a_write_mixb, iov, FRAME_SIZE);
25 mixb_read_n_iov (&pvt->a_write_mixb, iov, FRAME_SIZE);
26 mixb_read_upd (&pvt->a_write_mixb, FRAME_SIZE);
27 + change_audio_endianness_to_le(iov, iovcnt);
28 }
29 else if (used > 0)
30 {
31 @@ -579,6 +593,7 @@ static void timing_write (struct pvt* pv
32 iov[iovcnt].iov_base = silence_frame;
33 iov[iovcnt].iov_len = FRAME_SIZE - used;
34 iovcnt++;
35 + change_audio_endianness_to_le(iov, iovcnt);
36 }
37 else
38 {
39 @@ -588,6 +603,7 @@ static void timing_write (struct pvt* pv
40 iov[0].iov_base = silence_frame;
41 iov[0].iov_len = FRAME_SIZE;
42 iovcnt = 1;
43 + // ignore endianness for zeros
44 // continue;
45 }
46