class NatML.Recorders.Inputs.AsyncTextureInput : TextureInput

The AsyncTextureInput class provides a simple primitive for recording video frames from Texture objects. It works by performing asynchronous pixel buffer readbacks from the GPU. This typically provides much better performance over the TextureInput implementation.

This texture input is not supported on all platforms. Make sure to check SystemInfo.supportsAsyncGPUReadback before using it.

Creating the Texture Input

/// <summary>
/// Create a texture input which performs asynchronous readbacks.
/// </summary>
/// <param name="recorder">Media recorder to receive video frames.</param>
AsyncTextureInput (IMediaRecorder recorder);

The texture input is always created with a recorder which receives any frames committed by the input.

Inspecting the Frame Size

/// <summary>
/// Texture input frame size.
/// </summary>
(int width, int height) frameSize { get; }

Refer to the Inspecting the Frame Size section of the TextureInput class for more information.

Committing Video Frames

/// <summary>
/// Commit a video frame from a texture.
/// </summary>
/// <param name="texture">Source texture.</param>
/// <param name="timestamp">Frame timestamp in nanoseconds.</param>
void CommitFrame (Texture texture, long timestamp);

Refer to the Committing Video Frames section of the TextureInput class for more information.

Disposing the Recorder Input

/// <summary>
/// Stop recorder input and release resources.
/// </summary>
void Dispose ();

Refer to the Disposing the Recorder Input section of the TextureInput class for more information.

Do not use the input after the Dispose method has been called.

Last updated