Table of Contents

Class VirtualRtpSource

Namespace
VAST.RTP
Assembly
VAST.RTSP.dll

Represents a virtual RTP source that accepts raw RTP packets and produces decoded media samples.

public class VirtualRtpSource : INetworkSource, IMediaSource, IReferenceable, IDisposable, INetworkEndPoint, INetworkStat
Inheritance
VirtualRtpSource
Implements
Inherited Members

Constructors

VirtualRtpSource()

Initializes a new instance of the VirtualRtpSource class.

public VirtualRtpSource()

Properties

Accept

Whether source is accepted or not

public bool Accept { get; set; }

Property Value

bool

Capabilities

Gets the list of source capabilities

public List<SourceCapability> Capabilities { get; }

Property Value

List<SourceCapability>

CurrentStat

Gets current network statistics

public NetworkStat CurrentStat { get; }

Property Value

NetworkStat

EndPoint

Connected end point info

public IPProtoEndPoint EndPoint { get; }

Property Value

IPProtoEndPoint

IgnoreSequenceNo

Gets or sets whether sequence number continuity should be ignored. Default value if false, i.e. sequence number continuity checkup is enabled. Use with care (!) because disabled continuity checkup can produce corrupted frames.

public bool IgnoreSequenceNo { get; set; }

Property Value

bool

IsDisposed

Can be used to check whether object is already disposed and can't be used anymore

public bool IsDisposed { get; }

Property Value

bool

IsNetworkSource

Whether it's a network or local source.

public bool IsNetworkSource { get; }

Property Value

bool

Parameters

Gets or sets source parameters

public SourceParameters Parameters { get; set; }

Property Value

SourceParameters

PublishingPath

Publishing point name extracted from the source URI or by any other means (depends on the protocol)

public string PublishingPath { get; set; }

Property Value

string

ReceivedUri

Source URI when present (depends on the protocol)

public string ReceivedUri { get; set; }

Property Value

string

RefCount

Gets current reference count of the object

public int RefCount { get; }

Property Value

int

SocketError

Socket error got on disconnection

public ExtendedSocketError SocketError { get; }

Property Value

ExtendedSocketError

State

Current source state

public MediaState State { get; }

Property Value

MediaState

StreamCount

Total stream count of the source

public int StreamCount { get; }

Property Value

int

UniqueId

Unique source id

public Guid UniqueId { get; set; }

Property Value

Guid

Uri

URI to be opened. Meaningless for current class

public string Uri { get; set; }

Property Value

string

Methods

AddRef()

Add reference

public void AddRef()

AddStream(MediaType)

Add media type of media stream. At least one media stream shall be added. Normally one video and/or one audio stream should be added. Multiple video or multiple audio streams are possible but it depends on the sink whether they all be present in the output. Metadata must have PayloadType entry with RTP payload type of the stream.

public void AddStream(MediaType mediaType)

Parameters

mediaType MediaType

Type of media stream to add

AddStreams(string)

Adds media streams from an SDP description string.

public void AddStreams(string sdp)

Parameters

sdp string

The SDP string describing the media streams.

Dispose()

Releases all resources used by the VirtualRtpSource class.

public void Dispose()

GetMediaType(int)

Gets media type of the stream

public MediaType GetMediaType(int streamIndex)

Parameters

streamIndex int

Stream index to get media type for

Returns

MediaType

Media type of requested stream

OnError(string)

Generate source error with provided error description

public void OnError(string errorDescription)

Parameters

errorDescription string

Error description

Open()

Meaningless for current class because it's supposed that object is created if source media for this class is ready

public void Open()

PushRtpPacket(byte[], int, int, bool)

Push new RTP packet. Packet must be a complete raw RTP packet, including RTP headers, received from a socket or by any other means.

public void PushRtpPacket(byte[] rtpPacket, int offset, int length, bool discontinuity = false)

Parameters

rtpPacket byte[]

RTP packet data

offset int

Buffer offset to read data from

length int

Data length

discontinuity bool

Whether it's a discontinuity

PushRtpPacket(int, int, uint, uint, bool, byte[], int, int, bool)

Push new RTP packet with already parsed header

public void PushRtpPacket(int payloadType, int sequenceNo, uint timestamp, uint ssrc, bool marker, byte[] payload, int payloadOffset, int payloadLength, bool discontinuity = false)

Parameters

payloadType int

Payload type

sequenceNo int

Sequence number

timestamp uint

Timestamp

ssrc uint

SSRS

marker bool

Marker bit

payload byte[]

Payload data without header

payloadOffset int

Payload data offset

payloadLength int

Payload data length

discontinuity bool

Whether it's a discontinuity

PushRtpPacket(VersatileBuffer)

Push new RTP packet. VersatileBuffer must contain a complete raw RTP packet, including RTP headers, received from a socket or by any other means.

public void PushRtpPacket(VersatileBuffer rtpPacket)

Parameters

rtpPacket VersatileBuffer

VersatileBuffer with RTP packet

Release()

Release reference. If reference count becomes 0 then Dispose() method is called. Calling object must not use current object after this call.

public void Release()

SetDesiredOutputType(int, MediaType)

Sets desired output media type of the specified stream. Desired media type could be an incomplete media type specifying only necessary parameters. Source should implement decoding or encoding internally to provide requested output type. It is not guaranteed though that an actual output type will match a desired type exactly. GetMediaType function should be used to obtain actual output media type.

public Task SetDesiredOutputType(int streamIndex, MediaType desiredType)

Parameters

streamIndex int

Stream index to set desired output media type for

desiredType MediaType

Desired media type

Returns

Task

Start()

Start the source

public void Start()

Stop()

Stop the source

public void Stop()

Events

Error

Occurs when an error is encountered during streaming.

public event EventHandler<ErrorEventArgs> Error

Event Type

EventHandler<ErrorEventArgs>

NewSample

Occurs when a new media sample is ready.

public event EventHandler<NewSampleEventArgs> NewSample

Event Type

EventHandler<NewSampleEventArgs>

NewStream

Occurs when a new stream has been created.

public event EventHandler<NewStreamEventArgs> NewStream

Event Type

EventHandler<NewStreamEventArgs>

StateChanged

Occurs when the source state changes.

public event EventHandler<MediaState> StateChanged

Event Type

EventHandler<MediaState>