← Back to team overview

rohc team mailing list archive

Re: [Question #254639]: RTP and UDP

 

Question #254639 on rohc changed:
https://answers.launchpad.net/rohc/+question/254639

    Status: Open => Answered

Didier Barvaux proposed the following answer:
Hello,

>     I wonder How to distingiush the RTP header from the UDP
>  header, It seems as if there is no peculiar features for RTP
> header.In your lib, you think the UDP destination ports value in
> RTP headers can not appear in the single UDP headers,is it
> enough and abundant? your lib offers several UDP destination
> ports of RTP,However,is it all RTP ports?

In the RTP standard, there is no UDP port reserved for RTP traffic. The
UDP ports are chosen dynamically by the applications that create RTP
packets. This fact makes difficult for the ROHC library to detect the
IP/UDP/RTP streams among the non-RTP IP/UDP streams.

The very first versions of the ROHC library implemented the RTP
detection with a fixed list of UDP ports that were considered as used
only for RTP traffic. The list was static, it could only be changed by
editing the source code of the library and building it again. In short,
it was not very useful.

At some time in past, the list of UDP ports was made more dynamic:
several functions were added to the public API of the ROHC library to
manage the list (add/remove/reset). Defining the list of UDP ports
dedicated to RTP traffic was left to the application that uses the
library.

Later, a more flexible method was added. A new method was needed
because, even if the list of UDP ports was dynamic, some UDP ports
should still be reserved to RTP traffic for all source and destination
IP addresses. That doesn't fit how things are in the real world. So, the
library has now a way to specify a user function that is called for
every UDP packet: the function shall be written by the application that
uses the ROHC library, the function shall return true if the packet is
RTP and false if it doesn't, the function may perform any action to take
that decision, that's up to the application to write its own function
that fits its needs.

Please find hereafter several examples of RTP detection:
* basic example with one single static UDP port: https://bazaar.launchpad.net/~didier-barvaux/rohc/rohc-1.7.x/view/head:/examples/rtp_detection.c
* more advanced example that tries to perform some Deep Packet Inspection (DPI, https://en.wikipedia.org/wiki/Deep_packet_inspection) to detection whether the first bytes of the UDP payload match one RTP header or not: https://bazaar.launchpad.net/~didier-barvaux/rohc/rohc-1.7.x/view/head:/app/sniffer/sniffer.c#L1739

A smart (but complicated) way to detect RTP streams for an application
could be to analyze all the SIP packets (UDP port 5060 or TCP port 5060)
to detect the UDP ports that the SIP phone and the SIP server will use.

Regards,
Didier

-- 
You received this question notification because you are a member of ROHC
Team, which is an answer contact for rohc.