Accessing an RTP packet

This page describes what information about the data in an RTP packet can be accessed. It also describes various types of RTCP packets used to carry a variety of data/control information.

The data to be sent to an application is preceded by the RTP header. The data and header are packed into an RTP packet. To send any additional information about the RTP packet, the header extension is used.

Fixed header

An RTP packet's fixed header contains the following fields:

  • Version: Represents the version of the RTP.

  • Padding: Used to round off the bits. If this bit is set, it means the packet contains one or more additional padding octets at the end which are not part of the payload.

  • Extension: If this bit is set, then the fixed header must be followed by the header extension.

  • CSRC count: The number of CSRC (contributing sources) identifiers that follow the fixed header.

  • Marker: Allow significant events to be marked in a packet stream.

  • Payload type: Identifies the format of the RTP payload and determines its interpretation by the application.

  • Sequence number: Is a random number which is incremented by one for each RTP data packet sent. The packet receiver uses it to detect packet loss and to restore packet sequence.

  • Timestamp: reflects the sampling instant of the first octet in the RTP data packet.

  • SSRC: A random ID to identify the synchronization source. No two synchronization sources within an RTP session have the same SSRC identifier.

  • CSRC list: The list of CSRCs for the data contained in this packet. The number of identifiers is given by the CC field.

The format for a fixed header is depicted in the following code:

       
        
       
       0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |V=2|P|X|  CC   |M|     PT      |       sequence number         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                           timestamp                           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |           synchronization source (SSRC) identifier            |
   +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
   |            contributing source (CSRC) identifiers             |
   |                     ....(data is put here)                    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      

RRtpPacket class allows you to access and set the following fixed header fields for an RTP packet.

  • Payload

  • Sequence Number

  • Time stamp

  • SSRC

  • CSRCs

  • Header Extension

  • Payload Type

  • Marker

You can get the preceding RTP packet information if a call to IsOpen() returns ETrue .

Header extension

To allow additional information to be carried in an RTP data header, an extension mechanism is provided. The header format would look like the following:

       
        
       
       0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      defined by profile       |           length              |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                        header extension                       |
   |                             ....                              |
      

RRtpHeaderExtension class allows you to set the header extension type. You can retrieve the extension type and a pointer descriptor representing the header extension data.

Types of RTCP packets

The different types of RTCP packets are used to carry different data or control information. They are described as follows:

  1. Receiver Report Packet: For reception statistics from senders who are not active, in combination with Send Report for active senders.

  2. Sender Report packet: For transmission and reception statistics from active senders.

  3. SDES (Source Description) packet: For sending source description items such as CNAME, NAME, EMAIL, PHONE and so on.

  4. Bye packet: For indicating the end of participation.

  5. APP packet: For sending the application specific data.

Contributed sources

A Contributed sources (CSRC) is a source of a stream of RTP packets that has contributed to the combined stream produced by an RTP mixer. The mixer inserts a list of the SSRC identifiers of the sources that contributed to the generation of a specific packet into the RTP header. This list is called the CSRC list.

For example, in an audio conferencing a mixer indicates all the speakers whose speech is combined to produce the outgoing packet. This allows the receiver to indicate the current speaker, even though all the audio packets contain the same SSRC identifier of that of the mixer.

RRtpCSRCs allows you to retrieve the number of CSRCs in a given RTP packet. Get a specific CSRC using Count() and index operator[] respectively.

       
        
       
       TUint operator[](TUInt aIndex) const;
      

Specify the index value. 0 indicates the first CSRC.