Managing the RTCP packets and reports

This section describes how to send various types of RTCP packets, set the stream parameters, get stream statistics and close the session.

Sending various RTCP packets

To automatically send SR, RR, or SDES packets, call RRtpSession::SetRTCPAutoSend() with its paramter set to ETrue. For more information about these packets, see Managing send and receive reports.

session.SetRTCPAutoSend(ETrue);

Set the RTCP auto-send time interval in microseconds by calling RRtpSession::SetRtcpInterval().

session.SetRtcpInterval(1000);

If auto-sending is set to EFalse, call RRtpSession::SendRTCPPacketL() to send a packet.

//aPacket is a valid RTCP packet session.SendRTCPPacketL(aPacket);

For more information, see the definition of TRtpSendPacketType.

Call RRtpSession::SendAppL() to send an APP packet.

For an SDES RTP packet, call RRtpSession::SetSDESL() to set the SDES details such as CNAME, NAME, PHONE, EMAIL and so on. You must set these details before the packet is sent. The CNAME must be unique for an RTP session. RRtpSession::GetSDES() enables you to fetch the data associated with the specified SDES item.

You can set the data associated with a PRIV (Private Extensions) SDES item by calling RRtpSession::SetPRIVL(). PRIV (Private Extensions) SDES is not supported. Call RRtpSession::ByeL() to send an RTCP Bye packet.

Setting the stream parameters

The SetRtpStreamParameters() method sets the following stream parameters:

  • maximum number of sequential packets that must be received for a good stream.

  • maximum number of dropped packets to be considered a dropout.

  • maximum number of packets by which a packet can be delayed to be considered as dropped.

SetRtpStreamParameters(1,100,3000);// set MinSequential, MaxMisorder & MaxDropout 

Getting the stream statistics

The RRtpSession::RtcpStatistics() method provides sending and receiving statistics about the current active RTP session. The statistics depend on the contents of the latest Sender Report (SR) packets and Receiver Report (RR) packets. The returned TRtcpStatistics structure contains the following statistics:

Direction Statistic

Sending

Total number of packets sent from the beginning of the RTP session to the latest SR.

Total number of payload octets sent from the beginning of the RTP session to the latest SR.

Receiving

Inter-arrival jitter.

Total number of packets lost since the beginning of the RTP session.

Fraction of packets lost since the previous SR or RR.

For more information about these statistics, see the RTP standard in RFC 3550.

Closing a session

Close() closes the RTP session. All the send and receive streams are disconnected after this call.

session.Close(); 
delete session;