Show / Hide Table of Contents

Class RTPChannel

A communications channel for transmitting and receiving Real-time Protocol (RTP) and Real-time Control Protocol (RTCP) packets. This class performs the socket management functions.

Inheritance
System.Object
RTPChannel
RtpIceChannel
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: SIPSorcery.Net
Assembly: SIPSorcery.dll
Syntax
public class RTPChannel : IDisposable

Constructors

| Improve this Doc View Source

RTPChannel(Boolean, IPAddress, Int32, PortRange)

Creates a new RTP channel. The RTP and optionally RTCP sockets will be bound in the constructor. They do not start receiving until the Start method is called.

Declaration
public RTPChannel(bool createControlSocket, IPAddress bindAddress, int bindPort = 0, PortRange rtpPortRange = null)
Parameters
Type Name Description
System.Boolean createControlSocket

Set to true if a separate RTCP control socket should be created. If RTP and RTCP are being multiplexed (as they are for WebRTC) there's no need to a separate control socket.

System.Net.IPAddress bindAddress

Optional. An IP address belonging to a local interface that will be used to bind the RTP and control sockets to. If left empty then the IPv6 any address will be used if IPv6 is supported and fallback to the IPv4 any address.

System.Int32 bindPort

Optional. The specific port to attempt to bind the RTP port on.

PortRange rtpPortRange

Fields

| Improve this Doc View Source

m_controlReceiver

Declaration
protected UdpReceiver m_controlReceiver
Field Value
Type Description
UdpReceiver
| Improve this Doc View Source

m_rtpReceiver

Declaration
protected UdpReceiver m_rtpReceiver
Field Value
Type Description
UdpReceiver

Properties

| Improve this Doc View Source

ControlLocalEndPoint

The local end point the control socket is listening on.

Declaration
public IPEndPoint ControlLocalEndPoint { get; }
Property Value
Type Description
System.Net.IPEndPoint
| Improve this Doc View Source

ControlPort

The local port we are listening for RTCP packets on.

Declaration
public int ControlPort { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

IsClosed

Declaration
public bool IsClosed { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsDualMode

Returns true if the RTP socket supports dual mode IPv4 and IPv6. If the control socket exists it will be the same.

Declaration
public bool IsDualMode { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

LastRtpDestination

The last remote end point an RTP packet was sent to or received from. Used for reporting purposes only.

Declaration
protected IPEndPoint LastRtpDestination { get; set; }
Property Value
Type Description
System.Net.IPEndPoint
| Improve this Doc View Source

RTPLocalEndPoint

The local end point the RTP socket is listening on.

Declaration
public IPEndPoint RTPLocalEndPoint { get; }
Property Value
Type Description
System.Net.IPEndPoint
| Improve this Doc View Source

RTPPort

The local port we are listening for RTP (and whatever else is multiplexed) packets on.

Declaration
public int RTPPort { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

RtpSocket

Declaration
public Socket RtpSocket { get; }
Property Value
Type Description
System.Net.Sockets.Socket

Methods

| Improve this Doc View Source

Close(String)

Closes the session's RTP and control ports.

Declaration
public void Close(string reason)
Parameters
Type Name Description
System.String reason
| Improve this Doc View Source

Dispose()

Declaration
public void Dispose()
| Improve this Doc View Source

Dispose(Boolean)

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing
| Improve this Doc View Source

OnRTPPacketReceived(UdpReceiver, Int32, IPEndPoint, Byte[])

Event handler for packets received on the RTP UDP socket.

Declaration
protected virtual void OnRTPPacketReceived(UdpReceiver receiver, int localPort, IPEndPoint remoteEndPoint, byte[] packet)
Parameters
Type Name Description
UdpReceiver receiver

The UDP receiver the packet was received on.

System.Int32 localPort

The local port it was received on.

System.Net.IPEndPoint remoteEndPoint

The remote end point of the sender.

System.Byte[] packet

The raw packet received (note this may not be RTP if other protocols are being multiplexed).

| Improve this Doc View Source

Send(RTPChannelSocketsEnum, IPEndPoint, Byte[])

The send method for the RTP channel.

Declaration
public virtual SocketError Send(RTPChannelSocketsEnum sendOn, IPEndPoint dstEndPoint, byte[] buffer)
Parameters
Type Name Description
RTPChannelSocketsEnum sendOn

The socket to send on. Can be the RTP or Control socket.

System.Net.IPEndPoint dstEndPoint

The destination end point to send to.

System.Byte[] buffer

The data to send.

Returns
Type Description
System.Net.Sockets.SocketError

The result of initiating the send. This result does not reflect anything about whether the remote party received the packet or not.

| Improve this Doc View Source

Start()

Starts listening on the RTP and control ports.

Declaration
public void Start()
| Improve this Doc View Source

StartControlReceiver()

Starts the UDP receiver that listens for RTCP (control) packets.

Declaration
public void StartControlReceiver()
| Improve this Doc View Source

StartRtpReceiver()

Starts the UDP receiver that listens for RTP packets.

Declaration
public void StartRtpReceiver()

Events

| Improve this Doc View Source

OnClosed

Declaration
public event Action<string> OnClosed
Event Type
Type Description
System.Action<System.String>
| Improve this Doc View Source

OnControlDataReceived

Declaration
public event Action<int, IPEndPoint, byte[]> OnControlDataReceived
Event Type
Type Description
System.Action<System.Int32, System.Net.IPEndPoint, System.Byte[]>
| Improve this Doc View Source

OnRTPDataReceived

Declaration
public event Action<int, IPEndPoint, byte[]> OnRTPDataReceived
Event Type
Type Description
System.Action<System.Int32, System.Net.IPEndPoint, System.Byte[]>

Implements

System.IDisposable

Extension Methods

JSONWriter.ToJson(Object)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX