Table of Contents

Class GLESCaptureSession

Manages a camera capture session with a repeating request, but supports both repeating and on-demand conversion.

public sealed class GLESCaptureSession : CaptureSessionBase<GLESCaptureSession.Proxy>
Inheritance
object
GLESCaptureSession
Inherited Members
Extension Methods

Remarks

Texture conversion is done in native OpenGL-ES.

Constructors

GLESCaptureSession(Resolution, GraphicsFormat)

public GLESCaptureSession(Resolution resolution, GraphicsFormat textureFormat = null)

Parameters

resolution Resolution
textureFormat GraphicsFormat

If not specified, uses equivalent of RenderTextureFormat.ARGB32.

Fields

Texture

The output texture with converted frames.

public readonly Texture2D Texture

Field Value

Texture2D

Properties

CaptureTimestamp

The capture timestamp of the last processed frame.

public long CaptureTimestamp { get; }

Property Value

long

HasNewFrame

true if a capture was processed this frame; false otherwise.

public bool HasNewFrame { get; }

Property Value

bool

Methods

DisposeAsync()

Closes the session (if not already closed) and releases native resources.

public override ValueTask DisposeAsync()

Returns

ValueTask

ProcessSingleFrameAsync(CancellationToken)

Processes a single frame and returns the result.

public ValueTask<(long, Texture2D)> ProcessSingleFrameAsync(CancellationToken token = default)

Parameters

token CancellationToken

Returns

ValueTask<(long, Texture2D)>

Capture timestamp and updated texture. Timestamp will be -1 if the capture could not be processed.

Exceptions

InvalidOperationException

Thrown if continuous processing is active.

ObjectDisposedException
TimeoutException

SetupJobAsync()

Registers the texture and creates a job in the native C++ manager.

public ValueTask<uint> SetupJobAsync()

Returns

ValueTask<uint>

The ID of the source texture created for the job, which the capture session will render to, or 0 if the operation failed.

StartContinuousProcessing(int)

Starts continuous frame processing.

public void StartContinuousProcessing(int maxFramerate = 60)

Parameters

maxFramerate int

The maximum rate at which frames will be processed by the GLES pipeline.

Exceptions

InvalidOperationException

Thrown if continuous processing is already active.

Events

OnFrameProcessed

Callback for when a frame has been processed, with the frame texture and capture timestamp.

public event Action<Texture2D, long>? OnFrameProcessed

Event Type

Action<Texture2D, long>