Table of Contents

Class WebRTCSourceBlock

Namespace
VisioForge.Core.MediaBlocks.Sources
Assembly
VisioForge.Core.dll

WebRTC source block: receives video and audio from a producer on a GStreamer signalling server, such as a browser page or another application that calls in through a VisioForge.Core.MediaBlocks.Sinks.WebRTCSinkBlock's server. Together with that sink it makes a two-way call.

public class WebRTCSourceBlock : SourceMediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Remarks

Outputs decoded video and audio. Their formats are the ones the producer's streams decode to - read them from the negotiated caps downstream, the block sets none.

A WebRTC session is only described once the producer offers it, so the outputs are declared up front by VisioForge.Core.Types.X.Sources.WebRTCSourceSettings.VideoEnabled and VisioForge.Core.Types.X.Sources.WebRTCSourceSettings.AudioEnabled; the stream of a disabled one is received and discarded. The block receives one producer at a time. When the producer leaves, the outputs stop; a block that waits for a call (neither a producer id nor the first producer set) then plays the next producer that calls through the same outputs.

Constructors

WebRTCSourceBlock(WebRTCSourceSettings)

Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.WebRTCSourceBlock class.

public WebRTCSourceBlock(WebRTCSourceSettings settings)

Parameters

settings WebRTCSourceSettings

The WebRTC source settings.

Exceptions

ArgumentNullException

settings is null.

ArgumentException

Both VisioForge.Core.Types.X.Sources.WebRTCSourceSettings.VideoEnabled and VisioForge.Core.Types.X.Sources.WebRTCSourceSettings.AudioEnabled are off, so the block would have no output.

Properties

AudioOutput

Gets the decoded audio output, or null when VisioForge.Core.Types.X.Sources.WebRTCSourceSettings.AudioEnabled is off.

public MediaBlockPad AudioOutput { get; }

Property Value

MediaBlockPad

Remarks

Left unconnected, this pad is terminated with an internal null sink at build time. To connect it after the pipeline starts (AddBlockLive + ConnectLive), set OnDemandConnect on it before building.

Input

Gets the input pad. Always null for a source block.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets all input pads. Always empty for a source block.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the primary output pad: the video output, or the audio output when video is off.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets all output pads.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Settings

Gets or sets the WebRTC source settings. The outputs are created from them in the constructor.

public WebRTCSourceSettings Settings { get; set; }

Property Value

WebRTCSourceSettings

Exceptions

ArgumentNullException

The value is null.

Type

Gets the media block type identifier.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

VideoOutput

Gets the decoded video output, or null when VisioForge.Core.Types.X.Sources.WebRTCSourceSettings.VideoEnabled is off.

public MediaBlockPad VideoOutput { get; }

Property Value

MediaBlockPad

Remarks

Left unconnected, this pad is terminated with an internal null sink at build time. To connect it after the pipeline starts (AddBlockLive + ConnectLive), set OnDemandConnect on it before building.

Methods

Build()

Builds the block: webrtcsrc and, per enabled output, a raw capsfilter and a queue.

public override bool Build()

Returns

bool

true if successful; otherwise, false.

CleanUp()

Cleans up resources.

public void CleanUp()

Dispose(bool)

Releases resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

Whether to release managed resources.

GetCore()

Gets the core element wrapper.

public BaseElement GetCore()

Returns

BaseElement

Always null for this composite block.

GetElement()

Gets the native webrtcsrc element.

public Element GetElement()

Returns

Element

The underlying Gst.Element.

GetFilenameOrURL()

Gets the signalling server address.

public string GetFilenameOrURL()

Returns

string

The signalling server address.

IsAvailable()

Determines whether the WebRTC source is available (the webrtcsrc element of the GStreamer WebRTC plugin; on Linux, also webrtcbin and nicesrc from gstreamer1.0-plugins-bad and gstreamer1.0-nice).

public static bool IsAvailable()

Returns

bool

true if available; otherwise, false.

SetFilenameOrURL(string)

Sets the signalling server address.

public void SetFilenameOrURL(string value)

Parameters

value string

The signalling server address.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the pipeline context.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The owning pipeline.