@UnstableApi
class FrameCache : GlEffect


Caches the input frames.

Example usage: cache the processed frames when presenting them on screen, to accommodate for the possible fluctuation in video frame processing time between frames.

Summary

Public constructors

FrameCache(capacity: @IntRange(from = 1, to = 8) Int)

Creates a new instance.

Public functions

GlShaderProgram!
toGlShaderProgram(context: Context!, useHdr: Boolean)

Returns a GlShaderProgram that applies the effect.

Public properties

Int

The capacity of the frame cache.

Inherited functions

From androidx.media3.common.Effect
Long

Returns the expected duration of the output stream when the effect is applied given a input durationUs.

From androidx.media3.effect.GlEffect
Boolean
isNoOp(inputWidth: Int, inputHeight: Int)

Returns whether a GlEffect applies no change at every timestamp.

Public constructors

FrameCache

FrameCache(capacity: @IntRange(from = 1, to = 8) Int)

Creates a new instance.

The capacity should be chosen carefully. OpenGL could crash unexpectedly if the device is not capable of allocating the requested buffer.

Currently up to 8 frames can be cached in one FrameCache instance.

Parameters
capacity: @IntRange(from = 1, to = 8) Int

The capacity of the frame cache, must be greater than zero.

Public functions

toGlShaderProgram

fun toGlShaderProgram(context: Context!, useHdr: Boolean): GlShaderProgram!

Returns a GlShaderProgram that applies the effect.

Parameters
context: Context!

A Context.

useHdr: Boolean

Whether input textures come from an HDR source. If true, colors will be in linear RGB BT.2020. If false, colors will be in linear RGB BT.709.

Throws
androidx.media3.common.VideoFrameProcessingException

If an error occurs while creating the .

Public properties

capacity

val capacityInt

The capacity of the frame cache.