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, IMediaBlockInternalsInheritance
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
settingsWHEPServerSinkSettings-
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
Input
Gets the video input pad.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all input pads.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the output pad. Always null for sink blocks.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads. Always empty for sink blocks.
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets or sets the WHEP server settings.
public WHEPServerSinkSettings Settings { get; set; }Property Value
Type
Gets the media block type identifier.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds the whepserversink element.
public override bool Build()Returns
- bool
-
trueif successful;falseotherwise.
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 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
-
trueif this media block is available; otherwise,false.
SetFilenameOrURL(string)
Sets the address the WHEP server listens on.
public void SetFilenameOrURL(string value)Parameters
valuestring-
The server address.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the pipeline context.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
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> ConsumerAddedEvent Type
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