Class EncodingCamera
A desktop webcam encoded with the pure C# Vp8Encoder: a subclass captures I420 pictures on a thread of its own and gives them to Deliver(Func<VideoFrame>), which paces, previews and encodes them. Up to 30 pictures per second normally; at half size and 10 per second when the peer asks for less.
Inherited Members
Namespace: Uniform.Chat.Desktop.Cameras
Assembly: Uniform.Chat.dll
Syntax
public abstract class EncodingCamera : IVideoCamera, IAsyncDisposable
Properties
| Edit this page View SourceCanSwitch
Whether the device has another camera to switch to.
Declaration
public abstract bool CanSwitch { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Low
Whether to capture at half size, as the peer asked for less.
Declaration
protected bool Low { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
| Edit this page View SourceDeliver(Func<VideoFrame>)
Take a captured picture: dropped while paused or ahead of the frame rate; every third one previewed; encoded and given.
Declaration
protected void Deliver(Func<VideoFrame> picture)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<VideoFrame> | picture |
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
Declaration
public abstract ValueTask DisposeAsync()
Returns
| Type | Description |
|---|---|
| ValueTask | A task that represents the asynchronous dispose operation. |
LimitBitrate(long)
Follow the peer's limit: a coarser quantizer for lower rates; half size at 10 per second below Uniform.Chat.Desktop.Cameras.EncodingCamera.FallbackBelow, full size from Uniform.Chat.Desktop.Cameras.EncodingCamera.RestoreFrom.
Declaration
public void LimitBitrate(long bitsPerSecond)
Parameters
| Type | Name | Description |
|---|---|---|
| long | bitsPerSecond |
RequestKeyframe()
Make the next frame a keyframe.
Declaration
public void RequestKeyframe()
SetPaused(bool)
Stop sending and previewing, or start again; the device keeps capturing, so it resumes at once.
Declaration
public void SetPaused(bool pause)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | pause |
Start()
Start capturing and encoding.
Declaration
public abstract void Start()
SwitchCamera()
Switch to the device's next camera, e.g. from the front to the back; nothing with one camera.
Declaration
public abstract void SwitchCamera()
Events
| Edit this page View SourceFrameEncoded
Raised with each encoded VP8 frame, the first a keyframe; on any thread.
Declaration
public event Action<byte[]>? FrameEncoded
Event Type
| Type | Description |
|---|---|
| Action<byte[]> |
Previewed
Raised with small pictures of what the camera sees, for a preview, a few per second; on any thread. Cameras without a preview never raise it.
Declaration
public event Action<VideoFrame>? Previewed
Event Type
| Type | Description |
|---|---|
| Action<VideoFrame> |