Show / Hide Table of Contents

Class MediaStreamTrack

Inheritance
System.Object
MediaStreamTrack
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 MediaStreamTrack

Constructors

| Improve this Doc View Source

MediaStreamTrack(SDPMediaTypesEnum, Boolean, List<SDPAudioVideoMediaFormat>, MediaStreamStatusEnum, List<SDPSsrcAttribute>, Dictionary<Int32, RTPHeaderExtension>)

Creates a lightweight class to track a media stream track within an RTP session When supporting RFC3550 (the standard RTP specification) the relationship between an RTP stream and session is 1:1. For WebRTC and RFC8101 there can be multiple streams per session.

Declaration
public MediaStreamTrack(SDPMediaTypesEnum kind, bool isRemote, List<SDPAudioVideoMediaFormat> capabilities, MediaStreamStatusEnum streamStatus = MediaStreamStatusEnum.SendRecv, List<SDPSsrcAttribute> ssrcAttributes = null, Dictionary<int, RTPHeaderExtension> headerExtensions = null)
Parameters
Type Name Description
SDPMediaTypesEnum kind

The type of media for this stream. There can only be one stream per media type.

System.Boolean isRemote

True if this track corresponds to a media announcement from the remote party.

System.Collections.Generic.List<SDPAudioVideoMediaFormat> capabilities

The capabilities for the track being added. Where the same media type is supported locally and remotely only the mutual capabilities can be used. This will occur if we receive an SDP offer (add track initiated by the remote party) and we need to remove capabilities we don't support.

MediaStreamStatusEnum streamStatus

The initial stream status for the media track. Defaults to send receive.

System.Collections.Generic.List<SDPSsrcAttribute> ssrcAttributes

Optional. If the track is being created from an SDP announcement this parameter contains a list of the SSRC attributes that should then match the RTP header SSRC value for this track.

System.Collections.Generic.Dictionary<System.Int32, RTPHeaderExtension> headerExtensions
| Improve this Doc View Source

MediaStreamTrack(AudioFormat, MediaStreamStatusEnum)

Add a local audio track.

Declaration
public MediaStreamTrack(AudioFormat format, MediaStreamStatusEnum streamStatus = MediaStreamStatusEnum.SendRecv)
Parameters
Type Name Description
SIPSorceryMedia.Abstractions.AudioFormat format

The audio format that the local application supports.

MediaStreamStatusEnum streamStatus

Optional. The stream status for the audio track, e.g. whether send and receive or only one of.

| Improve this Doc View Source

MediaStreamTrack(SDPWellKnownMediaFormatsEnum[])

Adds a local audio track based on one or more well known audio formats. There is no equivalent for a local video track as there is no support in this library for any of the well known video formats.

Declaration
public MediaStreamTrack(params SDPWellKnownMediaFormatsEnum[] wellKnownAudioFormats)
Parameters
Type Name Description
SIPSorceryMedia.Abstractions.SDPWellKnownMediaFormatsEnum[] wellKnownAudioFormats

One or more well known audio formats.

| Improve this Doc View Source

MediaStreamTrack(VideoFormat, MediaStreamStatusEnum)

Add a local video track.

Declaration
public MediaStreamTrack(VideoFormat format, MediaStreamStatusEnum streamStatus = MediaStreamStatusEnum.SendRecv)
Parameters
Type Name Description
SIPSorceryMedia.Abstractions.VideoFormat format

The video format that the local application supports.

MediaStreamStatusEnum streamStatus

Optional. The stream status for the video track, e.g. whether send and receive or only one of.

| Improve this Doc View Source

MediaStreamTrack(List<AudioFormat>, MediaStreamStatusEnum)

Add a local audio track.

Declaration
public MediaStreamTrack(List<AudioFormat> formats, MediaStreamStatusEnum streamStatus = MediaStreamStatusEnum.SendRecv)
Parameters
Type Name Description
System.Collections.Generic.List<SIPSorceryMedia.Abstractions.AudioFormat> formats

The audio formats that the local application supports.

MediaStreamStatusEnum streamStatus

Optional. The stream status for the audio track, e.g. whether send and receive or only one of.

| Improve this Doc View Source

MediaStreamTrack(List<VideoFormat>, MediaStreamStatusEnum)

Add a local video track.

Declaration
public MediaStreamTrack(List<VideoFormat> formats, MediaStreamStatusEnum streamStatus = MediaStreamStatusEnum.SendRecv)
Parameters
Type Name Description
System.Collections.Generic.List<SIPSorceryMedia.Abstractions.VideoFormat> formats

The video formats that the local application supports.

MediaStreamStatusEnum streamStatus

Optional. The stream status for the video track, e.g. whether send and receive or only one of.

Properties

| Improve this Doc View Source

Capabilities

The media capabilities supported by this track.

Declaration
public List<SDPAudioVideoMediaFormat> Capabilities { get; }
Property Value
Type Description
System.Collections.Generic.List<SDPAudioVideoMediaFormat>
| Improve this Doc View Source

DefaultStreamStatus

Represents the original and default stream status for the track. This is set when the track is created and does not change. It allows tracks to be set back to their original state after being put on hold etc. For example if a track is added as receive only video source then when after on and off hold it needs to be known that the track reverts receive only rather than sendrecv.

Declaration
public MediaStreamStatusEnum DefaultStreamStatus { get; }
Property Value
Type Description
MediaStreamStatusEnum
| Improve this Doc View Source

HeaderExtensions

a=extmap - Mapping for RTP header extensions

Declaration
public Dictionary<int, RTPHeaderExtension> HeaderExtensions { get; }
Property Value
Type Description
System.Collections.Generic.Dictionary<System.Int32, RTPHeaderExtension>
| Improve this Doc View Source

IsRemote

Indicates whether this track was sourced by a remote connection.

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

Kind

The type of media stream represented by this track. Must be audio or video.

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

LastAbsoluteCaptureTimestamp

The last abs-capture-time received from the remote peer for this stream.

Declaration
public TimestampPair LastAbsoluteCaptureTimestamp { get; }
Property Value
Type Description
TimestampPair
| Improve this Doc View Source

LastRemoteSeqNum

The last seqnum received from the remote peer for this stream.

Declaration
public ushort LastRemoteSeqNum { get; }
Property Value
Type Description
System.UInt16
| Improve this Doc View Source

MaximumBandwidth

If set to a non-zero value for local tracks then a Transport Independent Bandwidth (TIAS) attribute will be included in any SDP for the track's media announcement. For remote tracks thi a non-zero value indicates the a TIAS attribute was set in the remote SDP media announcement. The bandwith is specified in bits per seconds (bps).

Declaration
public uint MaximumBandwidth { get; set; }
Property Value
Type Description
System.UInt32
Remarks

See https://tools.ietf.org/html/rfc3890.

| Improve this Doc View Source

NoDtmfSupport

By default audio channels will support DTMF via telephone events. To opt out of DTMF support set this property to true.

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

SdpSsrc

If the SDP remote the remote party provides "a=ssrc" attributes, as specified in RFC5576, this property will hold the values. The list can be used when an RTP/RTCP packet is received and needs to be matched against a media type or RTCP report.

Declaration
public Dictionary<uint, SDPSsrcAttribute> SdpSsrc { get; set; }
Property Value
Type Description
System.Collections.Generic.Dictionary<System.UInt32, SDPSsrcAttribute>
| Improve this Doc View Source

SeqNum

Declaration
public ushort SeqNum { get; }
Property Value
Type Description
System.UInt16
| Improve this Doc View Source

Ssrc

The value used in the RTP Synchronisation Source header field for media packets sent using this media stream. Be careful that the RTP Synchronisation Source header field should not be changed unless specific implementations require it. By default this value is chosen randomly, with the intent that no two synchronization sources within the same RTP session will have the same SSRC.

Declaration
public uint Ssrc { get; set; }
Property Value
Type Description
System.UInt32
| Improve this Doc View Source

StreamStatus

Holds the stream state of the track.

Declaration
public MediaStreamStatusEnum StreamStatus { get; }
Property Value
Type Description
MediaStreamStatusEnum
| Improve this Doc View Source

Timestamp

The value used in the RTP Timestamp header field for media packets sent using this media stream.

Declaration
public uint Timestamp { get; }
Property Value
Type Description
System.UInt32

Methods

| Improve this Doc View Source

GetFormatForPayloadID(Int32)

Gets the matching audio or video format for a payload ID.

Declaration
public SDPAudioVideoMediaFormat? GetFormatForPayloadID(int payloadID)
Parameters
Type Name Description
System.Int32 payloadID

The payload ID to get the format for.

Returns
Type Description
System.Nullable<SDPAudioVideoMediaFormat>

An audio or video format or null if no payload ID matched.

| Improve this Doc View Source

GetNextSeqNum()

Returns the next SeqNum to be used in the RTP Sequence Number header field for media packets sent using this media stream.

Declaration
public ushort GetNextSeqNum()
Returns
Type Description
System.UInt16
| Improve this Doc View Source

IsPayloadIDMatch(Int32)

Checks whether the payload ID in an RTP packet received from the remote call party is in this track's list.

Declaration
public bool IsPayloadIDMatch(int payloadID)
Parameters
Type Name Description
System.Int32 payloadID

The payload ID to check against.

Returns
Type Description
System.Boolean

True if the payload ID matches one of the codecs for this stream. False if not.

| Improve this Doc View Source

IsSsrcMatch(UInt32)

Checks whether a SSRC value from an RTP header or RTCP report matches a value expected for this track.

Declaration
public bool IsSsrcMatch(uint ssrc)
Parameters
Type Name Description
System.UInt32 ssrc

The SSRC value to check.

Returns
Type Description
System.Boolean

True if the SSRC value is expected for this track. False if not.

| Improve this Doc View Source

RestrictCapabilities(SDPAudioVideoMediaFormat)

To restrict MediaStream Capabilties to one Audio/Video format. This Audio/Video format must already be present in the previous list or if the list is empty/null

Usefull once you have successfully created a connection with a Peer to use the same format even even others negocitions are performed

Declaration
public bool RestrictCapabilities(SDPAudioVideoMediaFormat sdpAudioVideoMediaFormat)
Parameters
Type Name Description
SDPAudioVideoMediaFormat sdpAudioVideoMediaFormat

The Audio/Video Format to restrict

Returns
Type Description
System.Boolean

True if the operation has been performed

| Improve this Doc View Source

RestrictCapabilities(AudioFormat)

To restrict MediaStream Capabilties to one Audio format. This Audio format must already be present in the previous list or if the list is empty/null

Usefull once you have successfully created a connection with a Peer to use the same format even even others negocitions are performed

Declaration
public bool RestrictCapabilities(AudioFormat audioFormat)
Parameters
Type Name Description
SIPSorceryMedia.Abstractions.AudioFormat audioFormat

The Audio Format to restrict

Returns
Type Description
System.Boolean

True if the operation has been performed

| Improve this Doc View Source

RestrictCapabilities(VideoFormat)

To restrict MediaStream Capabilties to one Video format. This Video format must already be present in the previous list or if the list is empty/null

Usefull once you have successfully created a connection with a Peer to use the same format even even others negocitions are performed

Declaration
public bool RestrictCapabilities(VideoFormat videoFormat)
Parameters
Type Name Description
SIPSorceryMedia.Abstractions.VideoFormat videoFormat

The Video Format to restrict

Returns
Type Description
System.Boolean

True if the operation has been performed

Extension Methods

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