Table of Contents

Class WHEPServerSinkBlock

Namespace
VisioForge.Core.MediaBlocks.Sinks
Assembly
VisioForge.Core.dll

WHEP (WebRTC-HTTP Egress Protocol) server block: browsers and other WHEP players watch the stream over WebRTC by posting an offer to VisioForge.Core.MediaBlocks.Sinks.WHEPServerSinkBlock.EndpointUrl.

public class WHEPServerSinkBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Remarks

Connect encoded H.264 video, for example the output of VisioForge.Core.MediaBlocks.Sources.RTSPRAWSourceBlock: it is sent to every player as it arrives, with no decoding or encoding, so a camera costs almost no CPU however many players watch it. Raw video or another codec fails to connect and the pipeline does not start.

The server sends no CORS headers: a web page that plays the stream has to be served from the same address and port as the endpoint, or its requests forwarded there by the server that serves the page.

Chromium-based browsers (Chrome, Edge) played a camera's 1080p Main profile stream in our tests. A player whose decoder takes only constrained baseline gets no picture from a Main or High profile camera. VisioForge.Core.MediaBlocks.Sources.WHEPSourceBlock offers only the exact profile-level-id42e016, which camera streams (42c0…, 4d…, 64…) do not match, so it gets no picture from this block.

Constructors

WHEPServerSinkBlock(WHEPServerSinkSettings)

Initializes a new instance of the VisioForge.Core.MediaBlocks.Sinks.WHEPServerSinkBlock class.

public WHEPServerSinkBlock(WHEPServerSinkSettings settings)

Parameters

settings WHEPServerSinkSettings

The WHEP server settings.

Properties

EndpointUrl

Gets the URL WHEP players post their offer to: /whep/endpoint on VisioForge.Core.Types.X.Sinks.WHEPServerSinkSettings.ServerAddress, or null when the address is not an http:// URL. For a server listening on all addresses (0.0.0.0, [::]) the URL names this machine's loopback address; players on other machines use this machine's network address instead.

public string EndpointUrl { get; }

Property Value

string

Input

Gets the video input pad.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets all input pads.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the output pad. Always null for sink blocks.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets all output pads. Always empty for sink blocks.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Settings

Gets or sets the WHEP server settings.

public WHEPServerSinkSettings Settings { get; set; }

Property Value

WHEPServerSinkSettings

Type

Gets the media block type identifier.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds the whepserversink element.

public override bool Build()

Returns

bool

true if successful; false otherwise.

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 GStreamer wrapper element.

public BaseElement GetCore()

Returns

BaseElement

The VisioForge.Core.GStreamer.Base.BaseElement wrapper.

GetElement()

Gets the native GStreamer element.

public Element GetElement()

Returns

Element

The underlying Gst.Element.

GetFilenameOrURL()

Gets the address the WHEP server listens on.

public string GetFilenameOrURL()

Returns

string

The server address.

IsAvailable()

Determines whether this media block is available.

public static bool IsAvailable()

Returns

bool

true if this media block is available; otherwise, false.

SetFilenameOrURL(string)

Sets the address the WHEP server listens on.

public void SetFilenameOrURL(string value)

Parameters

value string

The server address.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the pipeline context.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The owning pipeline.

ConsumerAdded

Occurs when a player connects. VisioForge.Core.Types.Events.WebRTCConsumerEventArgs.PeerId is its session ID. Raised from a GStreamer thread.

public event EventHandler<WebRTCConsumerEventArgs> ConsumerAdded

Event Type

EventHandler<WebRTCConsumerEventArgs>

ConsumerRemoved

Occurs when a player disconnects. Raised from a GStreamer thread. Not raised for the players still connected when the pipeline stops: their sessions end with it.

public event EventHandler<WebRTCConsumerEventArgs> ConsumerRemoved

Event Type

EventHandler<WebRTCConsumerEventArgs>