Friday, 15 January 2010

c# - Get Timestamp rtp packet -



c# - Get Timestamp rtp packet -

i'm using packetdotnet retrieve info rtp header. there times when timestamp negative value.

gettimestamp(udppacket packetudp) { byte[] packet = packetudp.payloaddata; long timestamp = getrtpheadervalue(packet, 32, 63); homecoming timestamp; } private static int getrtpheadervalue(byte[] packet, int startbit, int endbit) { int result = 0; // number of bits in value int length = endbit - startbit + 1; // values in rtp header big endian, need these conversions (int = startbit; <= endbit; i++) { int byteindex = / 8; int bitshift = 7 - (i % 8); result += ((packet[byteindex] >> bitshift) & 1) * (int)math.pow(2, length - + startbit - 1); } homecoming result; }

it caused rtcp packets. if rtp info coming phone, phone send periodic rtcp reports. seem pop in every 200'th packet. format different , code reading same way - need handle rtcp packets.

the packets format: http://www.cl.cam.ac.uk/~jac22/books/mm/book/node162.html

c# timestamp rtp

No comments:

Post a Comment