atefsaeed2010 / datacard

Automatically exported from code.google.com/p/datacard
Other
0 stars 1 forks source link

chan_datacard is not endianess-safe #84

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The current trunk of chan_datacard produces horrible audio when being compiled 
for and run on big-endian machines (in my case: a HorstBox Professional 
residential gateway router).

I had the same problem with chan_mobile (from which - as far as I understand - 
chan_datacard is a fork), and was able to insert same byte swapping on the 
audio data buffers in the send- and receive- channel functions to fix the 
problem.

I also tried this for chan_datacard, and it works in receive direction (in 
channel_read()).
The send direction also improves a lot and is almost comprehensible, but still 
voice sounds "robotic" with my patch. I tried several things to solve this but 
none worked.
I am attaching the patch I created for channel.c. The first part of the patch 
is applied in iov_write(), byteswapping the iov-buffer(s) before writing them 
to the datacard device. This is what currently does still seem to have issues 
with robotic voice.
The second part also does a byteswap in channel_read() on the received audio 
data, and works perfectly (voice in receive direction is clear).

I have to admit that my patch is quite "brute-force" as I do not have much 
understanding of neither the GSM- nor the asterisk audio frame structure, also 
I lack significant understanding of the structure of the chan_datacard source. 
So just byteswapping some buffers might look like a quite blunt approach... as 
mentioned I did the same thing to get chan_mobile running and it worked 
perfectly for me.

A fix for this would be greatly appreciated, would be willing to spend some 
time on testing!

Original issue reported on code.google.com by karsih...@gmail.com on 31 Jul 2011 at 12:00

Attachments:

GoogleCodeExporter commented 9 years ago
Btw, I am using a E1750 stick, just to complete the info.

Original comment by karsih...@gmail.com on 31 Jul 2011 at 12:39

GoogleCodeExporter commented 9 years ago
thanks for patch, please migrate to 
http://code.google.com/p/asterisk-chan-dongle

Original comment by bg_...@mail.ru on 4 Aug 2011 at 11:31