fabioprado / asterisk-chan-dongle

Automatically exported from code.google.com/p/asterisk-chan-dongle
Other
0 stars 0 forks source link

Sparc loud noise problem #201

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Using default config with K3520 and E173u2 on debian x86 works fine, but on 
debian sparc (Linux mail 3.2.0-4-sparc64-smp #1 SMP Debian 3.2.65-1+deb7u1 
sparc64 GNU/Linux)  probably a big/little endian problem occurs.

Voice from GSM network to SIP is fine, but from SIP to GSM only loud noise. 
It is not bad codec problem - trying many codecs configs and direct connection 
from one dongle to another without SIP same effect - loud noise.

Original issue reported on code.google.com by marcin.o...@gmail.com on 18 Jan 2015 at 11:48

GoogleCodeExporter commented 9 years ago
This solved the problem:

diff -p5 chan_dongle-1.1.r14/channel.c chan_dongle-1.1.r14.patched/channel.c    

*** chan_dongle-1.1.r14/channel.c       2011-10-03 08:12:31.000000000 +0200     

--- chan_dongle-1.1.r14.patched/channel.c       2015-01-24 13:14:51.706589292 
+0100                                                           
*************** static int channel_write (struct ast_cha                        

*** 821,830 ****                                                                

--- 821,833 ----                                                                

                }                                                                                                                             

                if (pvt->a_timer)                                                                                                             
                {                                                                                                                             
+                   if(is_big_endian())                                         

+                       ast_frame_byteswap_le (f);                              

+                                                                               

                        count = mixb_free (&pvt->a_write_mixb, &cpvt->mixstream);                                                             

                        if (count < (size_t) f->datalen)                                                                                      
                        {                                                                                                                     
                                mixb_read_upd (&pvt->a_write_mixb, f->datalen - count);                                                       
*************** EXPORT_DEF const struct ast_channel_tech                        

*** 1382,1386 ****                                                              

--- 1385,1399 ----                                                              

        .devicestate            = channel_devicestate,                                                                                        
        .indicate               = channel_indicate,                                                                                           
        .func_channel_read      = channel_func_read,                                                                                          
        .func_channel_write     = channel_func_write                                                                                          
  };                                                                                                                                          
+                                                                               

+ int is_big_endian(void)                                                       

+ {                                                                             

+     union {                                                                   

+         uint32_t i;                                                           

+         char c[4];                                                            

+     } e = { 0x01000000 };                                                     

+     return e.c[0];                                                            

+ }                                                                             

+ 

Original comment by marcin.o...@gmail.com on 24 Jan 2015 at 12:17

GoogleCodeExporter commented 9 years ago
thanks for patch

Original comment by bg_...@mail.ru on 14 Mar 2015 at 4:16