Show / Hide Table of Contents

Class MediaStream

Inheritance
System.Object
MediaStream
AudioStream
VideoStream
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.RTP
Assembly: SIPSorcery.dll
Syntax
public class MediaStream

Constructors

| Improve this Doc View Source

MediaStream(RtpSessionConfig, Int32)

Declaration
public MediaStream(RtpSessionConfig config, int index)
Parameters
Type Name Description
RtpSessionConfig config
System.Int32 index

Fields

| Improve this Doc View Source

_isClosed

Declaration
protected bool _isClosed
Field Value
Type Description
System.Boolean
| Improve this Doc View Source

_pendingPackagesBuffer

Declaration
protected List<MediaStream.PendingPackages> _pendingPackagesBuffer
Field Value
Type Description
System.Collections.Generic.List<MediaStream.PendingPackages>
| Improve this Doc View Source

_pendingPackagesLock

Declaration
protected object _pendingPackagesLock
Field Value
Type Description
System.Object
| Improve this Doc View Source

Index

Declaration
public int Index
Field Value
Type Description
System.Int32
| Improve this Doc View Source

rtpChannel

Declaration
protected RTPChannel rtpChannel
Field Value
Type Description
RTPChannel
| Improve this Doc View Source

SecureContext

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

SrtpHandler

Declaration
protected SrtpHandler SrtpHandler
Field Value
Type Description
SrtpHandler

Properties

| Improve this Doc View Source

AcceptRtpFromAny

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

ControlDestinationEndPoint

The remote RTP control end point this stream is sending to RTCP reports for the media stream to.

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

DefaultRTPEventFormat

Default RTP event format that we support.

Declaration
public static SDPAudioVideoMediaFormat DefaultRTPEventFormat { get; }
Property Value
Type Description
SDPAudioVideoMediaFormat
| Improve this Doc View Source

DestinationEndPoint

The remote RTP end point this stream is sending media to.

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

IsClosed

Indicates whether the session has been closed. Once a session is closed it cannot be restarted.

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

LocalTrack

The local track. Will be null if we are not sending this media.

Declaration
public MediaStreamTrack LocalTrack { get; set; }
Property Value
Type Description
MediaStreamTrack
| Improve this Doc View Source

MediaType

To type of this media

Declaration
public SDPMediaTypesEnum MediaType { get; set; }
Property Value
Type Description
SDPMediaTypesEnum
| Improve this Doc View Source

RemoteRtpEventPayloadID

In order to detect RTP events from the remote party this property needs to be set to the payload ID they are using.

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

RemoteTrack

The remote video track. Will be null if the remote party is not sending this media

Declaration
public MediaStreamTrack RemoteTrack { get; set; }
Property Value
Type Description
MediaStreamTrack
| Improve this Doc View Source

RtcpSession

The reporting session for this media stream.

Declaration
public RTCPSession RtcpSession { get; set; }
Property Value
Type Description
RTCPSession

Methods

| Improve this Doc View Source

AddBuffer(TimeSpan)

Declaration
public void AddBuffer(TimeSpan dropPacketTimeout)
Parameters
Type Name Description
System.TimeSpan dropPacketTimeout
| Improve this Doc View Source

AddPendingPackage(RTPHeader, Int32, IPEndPoint, Byte[], VideoStream)

Declaration
protected virtual bool AddPendingPackage(RTPHeader hdr, int localPort, IPEndPoint remoteEndPoint, byte[] buffer, VideoStream videoStream = null)
Parameters
Type Name Description
RTPHeader hdr
System.Int32 localPort
System.Net.IPEndPoint remoteEndPoint
System.Byte[] buffer
VideoStream videoStream
Returns
Type Description
System.Boolean
| Improve this Doc View Source

AddRtpChannel(RTPChannel)

Declaration
public void AddRtpChannel(RTPChannel rtpChannel)
Parameters
Type Name Description
RTPChannel rtpChannel
| Improve this Doc View Source

AdjustRemoteEndPoint(UInt32, IPEndPoint)

Adjusts the expected remote end point for a particular media type.

Declaration
protected bool AdjustRemoteEndPoint(uint ssrc, IPEndPoint receivedOnEndPoint)
Parameters
Type Name Description
System.UInt32 ssrc

The SSRC from the RTP packet header.

System.Net.IPEndPoint receivedOnEndPoint

The actual remote end point that the RTP packet came from.

Returns
Type Description
System.Boolean

True if remote end point for this media type was the expected one or it was adjusted. False if the remote end point was deemed to be invalid for this media type.

| Improve this Doc View Source

CheckIfCanSendRtpRaw()

Declaration
protected bool CheckIfCanSendRtpRaw()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

ClearPendingPackages()

Declaration
protected virtual void ClearPendingPackages()
| Improve this Doc View Source

CreateRtcpSession()

Creates a new RTCP session for a media track belonging to this RTP session.

Declaration
public bool CreateRtcpSession()
Returns
Type Description
System.Boolean

A new RTCPSession object. The RTCPSession must have its Start method called in order to commence sending RTCP reports.

| Improve this Doc View Source

DispatchPendingPackages()

Declaration
protected virtual void DispatchPendingPackages()
| Improve this Doc View Source

EnsureBufferUnprotected(Byte[], RTPHeader, out RTPPacket)

Declaration
public bool EnsureBufferUnprotected(byte[] buf, RTPHeader header, out RTPPacket packet)
Parameters
Type Name Description
System.Byte[] buf
RTPHeader header
RTPPacket packet
Returns
Type Description
System.Boolean
| Improve this Doc View Source

GetBuffer()

Declaration
public RTPReorderBuffer GetBuffer()
Returns
Type Description
RTPReorderBuffer
| Improve this Doc View Source

GetOrCreateSrtpHandler()

Declaration
public SrtpHandler GetOrCreateSrtpHandler()
Returns
Type Description
SrtpHandler
| Improve this Doc View Source

GetRTPChannel()

Declaration
public RTPChannel GetRTPChannel()
Returns
Type Description
RTPChannel
| Improve this Doc View Source

GetSecurityContext()

Declaration
public SecureContext GetSecurityContext()
Returns
Type Description
SecureContext
| Improve this Doc View Source

GetSendingFormat()

Attempts to get the highest priority sending format for the remote call party.

Declaration
public SDPAudioVideoMediaFormat GetSendingFormat()
Returns
Type Description
SDPAudioVideoMediaFormat

The first compatible media format found for the specified media type.

| Improve this Doc View Source

HasRtpChannel()

Declaration
public bool HasRtpChannel()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsSecurityContextReady()

Declaration
public bool IsSecurityContextReady()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

LogIfWrongSeqNumber(String, RTPHeader, MediaStreamTrack)

Declaration
protected void LogIfWrongSeqNumber(string trackType, RTPHeader header, MediaStreamTrack track)
Parameters
Type Name Description
System.String trackType
RTPHeader header
MediaStreamTrack track
| Improve this Doc View Source

OnReceiveRTPPacket(RTPHeader, Int32, IPEndPoint, Byte[], VideoStream)

Declaration
public void OnReceiveRTPPacket(RTPHeader hdr, int localPort, IPEndPoint remoteEndPoint, byte[] buffer, VideoStream videoStream = null)
Parameters
Type Name Description
RTPHeader hdr
System.Int32 localPort
System.Net.IPEndPoint remoteEndPoint
System.Byte[] buffer
VideoStream videoStream
| Improve this Doc View Source

ProcessHeaderExtensions(RTPHeader, IPEndPoint)

Declaration
public void ProcessHeaderExtensions(RTPHeader header, IPEndPoint remoteEndPoint)
Parameters
Type Name Description
RTPHeader header
System.Net.IPEndPoint remoteEndPoint
| Improve this Doc View Source

RaiseOnReceiveReportByIndex(IPEndPoint, RTCPCompoundPacket)

Declaration
public void RaiseOnReceiveReportByIndex(IPEndPoint ipEndPoint, RTCPCompoundPacket rtcpPCompoundPacket)
Parameters
Type Name Description
System.Net.IPEndPoint ipEndPoint
RTCPCompoundPacket rtcpPCompoundPacket
| Improve this Doc View Source

RaiseOnRtpEventByIndex(IPEndPoint, RTPEvent, RTPHeader)

Declaration
protected void RaiseOnRtpEventByIndex(IPEndPoint ipEndPoint, RTPEvent rtpEvent, RTPHeader rtpHeader)
Parameters
Type Name Description
System.Net.IPEndPoint ipEndPoint
RTPEvent rtpEvent
RTPHeader rtpHeader
| Improve this Doc View Source

RaiseOnRtpPacketReceivedByIndex(IPEndPoint, RTPPacket)

Declaration
protected void RaiseOnRtpPacketReceivedByIndex(IPEndPoint ipEndPoint, RTPPacket rtpPacket)
Parameters
Type Name Description
System.Net.IPEndPoint ipEndPoint
RTPPacket rtpPacket
| Improve this Doc View Source

RemoveBuffer(TimeSpan)

Declaration
public void RemoveBuffer(TimeSpan dropPacketTimeout)
Parameters
Type Name Description
System.TimeSpan dropPacketTimeout
| Improve this Doc View Source

SendRtcpFeedback(RTCPFeedback)

Allows sending of RTCP feedback reports.

Declaration
public void SendRtcpFeedback(RTCPFeedback feedback)
Parameters
Type Name Description
RTCPFeedback feedback

The feedback report to send.

| Improve this Doc View Source

SendRtcpRaw(Byte[])

Allows additional control for sending raw RTCP payloads

Declaration
public void SendRtcpRaw(byte[] rtcpBytes)
Parameters
Type Name Description
System.Byte[] rtcpBytes

Raw RTCP report data to send.

| Improve this Doc View Source

SendRtcpReport(RTCPCompoundPacket)

Sends the RTCP report to the remote call party.

Declaration
public void SendRtcpReport(RTCPCompoundPacket report)
Parameters
Type Name Description
RTCPCompoundPacket report

RTCP report to send.

| Improve this Doc View Source

SendRtpRaw(Byte[], UInt32, Int32, Int32)

Allows additional control for sending raw RTP payloads. No framing or other processing is carried out.

Declaration
public void SendRtpRaw(byte[] data, uint timestamp, int markerBit, int payloadType)
Parameters
Type Name Description
System.Byte[] data

The RTP packet payload.

System.UInt32 timestamp

The timestamp to set on the RTP header.

System.Int32 markerBit

The value to set on the RTP header marker bit, should be 0 or 1.

System.Int32 payloadType

The payload ID to set in the RTP header.

| Improve this Doc View Source

SendRtpRaw(Byte[], UInt32, Int32, Int32, Boolean, Nullable<UInt16>)

Declaration
protected void SendRtpRaw(byte[] data, uint timestamp, int markerBit, int payloadType, bool checkDone, ushort? seqNum = null)
Parameters
Type Name Description
System.Byte[] data
System.UInt32 timestamp
System.Int32 markerBit
System.Int32 payloadType
System.Boolean checkDone
System.Nullable<System.UInt16> seqNum
| Improve this Doc View Source

SendRtpRaw(Byte[], UInt32, Int32, Int32, UInt16)

Allows additional control for sending raw RTP payloads. No framing or other processing is carried out.

Declaration
public void SendRtpRaw(byte[] data, uint timestamp, int markerBit, int payloadType, ushort seqNum)
Parameters
Type Name Description
System.Byte[] data

The RTP packet payload.

System.UInt32 timestamp

The timestamp to set on the RTP header.

System.Int32 markerBit

The value to set on the RTP header marker bit, should be 0 or 1.

System.Int32 payloadType

The payload ID to set in the RTP header.

System.UInt16 seqNum

The RTP sequence number

| Improve this Doc View Source

SetDestination(IPEndPoint, IPEndPoint)

Sets the remote end points for a media type supported by this RTP session.

Declaration
public void SetDestination(IPEndPoint rtpEndPoint, IPEndPoint rtcpEndPoint)
Parameters
Type Name Description
System.Net.IPEndPoint rtpEndPoint

The remote end point for RTP packets corresponding to the media type.

System.Net.IPEndPoint rtcpEndPoint

The remote end point for RTCP packets corresponding to the media type.

| Improve this Doc View Source

SetRtpHeaderExtensionValue(String, Object)

To set a new value to a RTP Header extension.

According the extension the Object expected as value is different - check on each extension

Declaration
public void SetRtpHeaderExtensionValue(string uri, object value)
Parameters
Type Name Description
System.String uri

The URI of the extension to use

System.Object value

Object to set on the extension (check extension to know object type)

| Improve this Doc View Source

SetSecurityContext(ProtectRtpPacket, ProtectRtpPacket, ProtectRtpPacket, ProtectRtpPacket)

Declaration
public void SetSecurityContext(ProtectRtpPacket protectRtp, ProtectRtpPacket unprotectRtp, ProtectRtpPacket protectRtcp, ProtectRtpPacket unprotectRtcp)
Parameters
Type Name Description
ProtectRtpPacket protectRtp
ProtectRtpPacket unprotectRtp
ProtectRtpPacket protectRtcp
ProtectRtpPacket unprotectRtcp
| Improve this Doc View Source

UseBuffer()

Declaration
public bool UseBuffer()
Returns
Type Description
System.Boolean

Events

| Improve this Doc View Source

OnIsClosedStateChanged

Declaration
public event Action<bool> OnIsClosedStateChanged
Event Type
Type Description
System.Action<System.Boolean>
| Improve this Doc View Source

OnReceiveReportByIndex

Gets fired when an RTCP report is received. This event is for diagnostics only.

Declaration
public event Action<int, IPEndPoint, SDPMediaTypesEnum, RTCPCompoundPacket> OnReceiveReportByIndex
Event Type
Type Description
System.Action<System.Int32, System.Net.IPEndPoint, SDPMediaTypesEnum, RTCPCompoundPacket>
| Improve this Doc View Source

OnRtpEventByIndex

Gets fired when an RTP event is detected on the remote call party's RTP stream.

Declaration
public event Action<int, IPEndPoint, RTPEvent, RTPHeader> OnRtpEventByIndex
Event Type
Type Description
System.Action<System.Int32, System.Net.IPEndPoint, RTPEvent, RTPHeader>
| Improve this Doc View Source

OnRtpHeaderReceivedByIndex

Gets fired when an RTP Header packet is received from a remote party. Parameters are:

  • index of the AudioStream or VideoStream
  • Remote endpoint packet was received from,
  • The media type the packet contains, will be audio or video,
  • The RTP Header exension URI.
Declaration
public event Action<int, IPEndPoint, SDPMediaTypesEnum, string, object> OnRtpHeaderReceivedByIndex
Event Type
Type Description
System.Action<System.Int32, System.Net.IPEndPoint, SDPMediaTypesEnum, System.String, System.Object>
| Improve this Doc View Source

OnRtpPacketReceivedByIndex

Gets fired when an RTP packet is received from a remote party. Parameters are:

  • index of the AudioStream or VideoStream
  • Remote endpoint packet was received from,
  • The media type the packet contains, will be audio or video,
  • The full RTP packet.
Declaration
public event Action<int, IPEndPoint, SDPMediaTypesEnum, RTPPacket> OnRtpPacketReceivedByIndex
Event Type
Type Description
System.Action<System.Int32, System.Net.IPEndPoint, SDPMediaTypesEnum, RTPPacket>
| Improve this Doc View Source

OnSendReportByIndex

Gets fired when an RTCP report is sent. This event is for diagnostics only.

Declaration
public event Action<int, SDPMediaTypesEnum, RTCPCompoundPacket> OnSendReportByIndex
Event Type
Type Description
System.Action<System.Int32, SDPMediaTypesEnum, RTCPCompoundPacket>
| Improve this Doc View Source

OnTimeoutByIndex

Fires when the connection for a media type is classified as timed out due to not receiving any RTP or RTCP packets within the given period.

Declaration
public event Action<int, SDPMediaTypesEnum> OnTimeoutByIndex
Event Type
Type Description
System.Action<System.Int32, SDPMediaTypesEnum>

Extension Methods

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