android - sipdroid data encrypt failed -
i want make custom sipdroid client using reverse byte order. think makes other voip clients cannot decode these data.
so read code of sipdroid. found rtp data goes way: 1. audiorecord.read(originalpcm) 2. encode(originalpcm, encodeddata) 3. rtp_socket.send(rtp_packet) //the encodedata rtp_packet's data part
and other side is: 1. rtp_receive(rtp_packet) 2. decode(encodedata, pcmdata) //the encodedata rtp_packet's data part 3. audiotrack.write(pcmdata)
so modified sipdroidsocket class. in send method, add following code @ beginning.
byte[] b = pack.getdata(); reverse(b); pack.setdata(b); and add following code @ end of receive method.
byte[] b = pack.getdata(); reverse(b); pack.setdata(b); i think in way, 2 client can work usual. failed. , don't know reason. please me find out why. thanks.
you should not reverse hole buffer unless receive 2,4,8 bytes @ time. should treat data elements of 2,4,8 bytes depending on how data stored. code see here not work. suppose have buffer of data bytes 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08 stored 4 byte elements of 0x04030201-0x08070605. reversing hole buffer produce 0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01 wrong because end 0x05060708-0x04030201 if reverse 1 element(4 bytes) @ time. keep in mind size of element depends on how values stored
Comments
Post a Comment