I need to write (c++, linux) rtp analyzer like:http://mmlab.disi.unitn.it/wiki/index.php/Analyzer. But I can't understand some technical moments, such as how server, wich receives udp-datagrams, determines that one udp-datagram had finished and another udp-datagram started and how it identifies udp-datagrams, containing rtp. It would be great to see the code of analyzer, but I haven't find it. Could you help me to find the answers to my questions (I wonder to know how it can be implemented via sockets). Thank you very much, I will really appreciate it!
Asked
Active
Viewed 1,023 times
1 Answers
2
If I do understand your question correctly, you can follow the steps stated below:
- Write a server program in c++ using one of the socket libraries, and create a UDP socket.
- Listen to the port to which your client is sending the RTP packets.
- While you listen to the specified UDP port, you will get UDP packets one by one.
- When you get a UDP packet parse the length field which is a 2 byte field, and starts at 4th byte.
- Length - 8 (UDP header size in bytes) is what you looking for, and actually the size of the RTP packet.
- Get the RTP packet by getting the bits between 8th byte of the UDP packet to Length'the byte.
- Then you have your RTP packet, you can also parse it in the same way by looking at how it looks like in RFC3550 by IETF.
(Also good to specify that UDP packets might arrive out of order, and you can use the sequence number field in the RTP header, to reorder them)

Erman Doser
- 116
- 1
- 6