Class RTCPSession
Represents an RTCP session intended to be used in conjunction with an RTP session. This class needs to get notified of all RTP sends and receives and will take care of RTCP reporting.
Inheritance
Inherited Members
Namespace: SIPSorcery.Net
Assembly: SIPSorcery.dll
Syntax
public class RTCPSession
Remarks
RTCP Design Decisions:
- Minimum Report Period set to 5s as per RFC3550: 6.2 RTCP Transmission Interval (page 24).
- Delay for initial report transmission set to 2.5s (0.5 * minimum report period) as per RFC3550: 6.2 RTCP Transmission Interval (page 26).
- Randomisation factor to apply to report intervals to attempt to ensure RTCP reports amongst participants don't become synchronised [0.5 * interval, 1.5 * interval] as per RFC3550: 6.2 RTCP Transmission Interval (page 26).
- Timeout period during which if no RTP or RTCP packets received a participant is assumed to have dropped 5 x minimum report period as per RFC3550: 6.2.1 (page 27) and 6.3.5 (page 31).
- All RTCP composite reports must satisfy (this includes when a BYE is sent):
- First RTCP packet must be a SR or RR,
- Must contain an SDES packet.
Constructors
| Improve this Doc View SourceRTCPSession(SDPMediaTypesEnum, UInt32)
Default constructor.
Declaration
public RTCPSession(SDPMediaTypesEnum mediaType, uint ssrc)
Parameters
Type | Name | Description |
---|---|---|
SDPMediaTypesEnum | mediaType | The media type this reporting session will be measuring. |
System.UInt32 | ssrc | The SSRC of the RTP stream being sent. |
Fields
| Improve this Doc View SourceNO_ACTIVITY_TIMEOUT_REASON
Declaration
public const string NO_ACTIVITY_TIMEOUT_REASON = "No activity timeout."
Field Value
Type | Description |
---|---|
System.String |
Properties
| Improve this Doc View SourceCname
Unique common name field for use in SDES packets.
Declaration
public string Cname { get; }
Property Value
Type | Description |
---|---|
System.String |
CreatedAt
Timestamp that the RTCP session was created at.
Declaration
public DateTime CreatedAt { get; }
Property Value
Type | Description |
---|---|
System.DateTime |
IsClosed
Indicates whether the RTCP session has been closed. An RTCP BYE request will typically trigger an close.
Declaration
public bool IsClosed { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsTimedOut
Indicates whether the session is currently in a timed out state. This occurs if no RTP or RTCP packets have been received during an expected interval.
Declaration
public bool IsTimedOut { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
LastActivityAt
Timestamp that the last RTP or RTCP packet for was received at.
Declaration
public DateTime LastActivityAt { get; }
Property Value
Type | Description |
---|---|
System.DateTime |
LastNtpTimestampSent
The last NTP timestamp corresponding to the last RTP timestamp sent by us.
Declaration
public ulong LastNtpTimestampSent { get; }
Property Value
Type | Description |
---|---|
System.UInt64 |
LastRtpTimestampSent
The last RTP timestamp sent by us.
Declaration
public uint LastRtpTimestampSent { get; }
Property Value
Type | Description |
---|---|
System.UInt32 |
LastSeqNum
The last RTP sequence number sent by us.
Declaration
public ushort LastSeqNum { get; }
Property Value
Type | Description |
---|---|
System.UInt16 |
MediaType
The media type this report session is measuring.
Declaration
public SDPMediaTypesEnum MediaType { get; }
Property Value
Type | Description |
---|---|
SDPMediaTypesEnum |
OctetsReceivedCount
Number of RTP bytes received from the remote party.
Declaration
public uint OctetsReceivedCount { get; }
Property Value
Type | Description |
---|---|
System.UInt32 |
OctetsSentCount
Number of RTP bytes sent to the remote party.
Declaration
public uint OctetsSentCount { get; }
Property Value
Type | Description |
---|---|
System.UInt32 |
PacketsReceivedCount
Number of RTP packets received from the remote party.
Declaration
public uint PacketsReceivedCount { get; }
Property Value
Type | Description |
---|---|
System.UInt32 |
PacketsSentCount
Number of RTP packets sent to the remote party.
Declaration
public uint PacketsSentCount { get; }
Property Value
Type | Description |
---|---|
System.UInt32 |
PayloadSampleRateHz
Indicates the sample rate for RTP media data.
Declaration
public int PayloadSampleRateHz { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
ReceptionReport
The reception report to keep track of the RTP statistics from packets received from the remote call party.
Declaration
public ReceptionReport ReceptionReport { get; }
Property Value
Type | Description |
---|---|
ReceptionReport |
Ssrc
The SSRC number of the RTP packets we are sending.
Declaration
public uint Ssrc { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
StartedAt
Timestamp that the RTCP session sender report scheduler was started at.
Declaration
public DateTime StartedAt { get; }
Property Value
Type | Description |
---|---|
System.DateTime |
Methods
| Improve this Doc View SourceClose(String)
Declaration
public void Close(string reason)
Parameters
Type | Name | Description |
---|---|---|
System.String | reason |
DateTimeToNtpTimestamp(DateTime)
Converts specified DateTime value to long NTP time.
Declaration
public static ulong DateTimeToNtpTimestamp(DateTime value)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | value | DateTime value to convert. This value must be in local time. |
Returns
Type | Description |
---|---|
System.UInt64 | Returns NTP value. |
DateTimeToNtpTimestamp32(DateTime)
Declaration
public static uint DateTimeToNtpTimestamp32(DateTime value)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | value |
Returns
Type | Description |
---|---|
System.UInt32 |
GetRtcpReport()
Gets the RTCP compound packet containing the RTCP reports we send.
Declaration
public RTCPCompoundPacket GetRtcpReport()
Returns
Type | Description |
---|---|
RTCPCompoundPacket | An RTCP compound packet. |
RecordRtpPacketReceived(RTPPacket)
Event handler for an RTP packet being received by the RTP session. Used for measuring transmission statistics.
Declaration
public void RecordRtpPacketReceived(RTPPacket rtpPacket)
Parameters
Type | Name | Description |
---|---|---|
RTPPacket | rtpPacket |
RecordRtpPacketSend(RTPPacket)
Event handler for an RTP packet being sent by the RTP session. Used for measuring transmission statistics.
Declaration
public void RecordRtpPacketSend(RTPPacket rtpPacket)
Parameters
Type | Name | Description |
---|---|---|
RTPPacket | rtpPacket |
RemoveReceptionReport(UInt32)
Removes the reception report when the remote party indicates no more RTP packets for that SSRC will be received by sending an RTCP BYE.
Declaration
public void RemoveReceptionReport(uint ssrc)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | ssrc | The SSRC of the reception report being closed. Typically this should be the SSRC received in the RTCP BYE. |
ReportReceived(IPEndPoint, RTCPCompoundPacket)
Event handler for an RTCP packet being received from the remote party.
Declaration
public void ReportReceived(IPEndPoint remoteEndPoint, RTCPCompoundPacket rtcpCompoundPacket)
Parameters
Type | Name | Description |
---|---|---|
System.Net.IPEndPoint | remoteEndPoint | The end point the packet was received from. |
RTCPCompoundPacket | rtcpCompoundPacket | The data received. |
Start()
Declaration
public void Start()
To32Bit(UInt64)
Declaration
public static uint To32Bit(ulong ntpTime)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | ntpTime |
Returns
Type | Description |
---|---|
System.UInt32 |
Events
| Improve this Doc View SourceOnReportReadyToSend
Event handler for sending RTCP reports.
Declaration
public event Action<SDPMediaTypesEnum, RTCPCompoundPacket> OnReportReadyToSend
Event Type
Type | Description |
---|---|
System.Action<SDPMediaTypesEnum, RTCPCompoundPacket> |
OnTimeout
Fires when the connection is classified as timed out due to not receiving any RTP or RTCP packets within the given period.
Declaration
public event Action<SDPMediaTypesEnum> OnTimeout
Event Type
Type | Description |
---|---|
System.Action<SDPMediaTypesEnum> |