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, IMediaBlockInternalsInheritance
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
settingsWebRTCSourceSettings-
The WebRTC source settings.
Exceptions
- ArgumentNullException
-
settingsisnull. - 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
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
Inputs
Gets all input pads. Always empty for a source block.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the primary output pad: the video output, or the audio output when video is off.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads.
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets or sets the WebRTC source settings. The outputs are created from them in the constructor.
public WebRTCSourceSettings Settings { get; set; }Property Value
Exceptions
- ArgumentNullException
-
The value is
null.
Type
Gets the media block type identifier.
public override MediaBlockType Type { get; }Property Value
VideoOutput
Gets the decoded video output, or null when VisioForge.Core.Types.X.Sources.WebRTCSourceSettings.VideoEnabled is off.
public MediaBlockPad VideoOutput { get; }Property Value
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
-
trueif successful; otherwise,false.
CleanUp()
Cleans up resources.
public void CleanUp()Dispose(bool)
Releases resources.
protected override void Dispose(bool disposing)Parameters
disposingbool-
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
-
trueif available; otherwise,false.
SetFilenameOrURL(string)
Sets the signalling server address.
public void SetFilenameOrURL(string value)Parameters
valuestring-
The signalling server address.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the pipeline context.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The owning pipeline.