FrameCache
@UnstableApi
public final class FrameCache implements 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 fields |
|
|---|---|
final int |
The capacity of the frame cache. |
Public constructors |
|---|
FrameCache(@IntRange(from = 1, to = 8) int capacity)Creates a new instance. |
Public methods |
|
|---|---|
GlShaderProgram |
toGlShaderProgram(Context context, boolean useHdr)Returns a |
Inherited methods |
||
|---|---|---|
|
||
Public fields
Public constructors
FrameCache
public FrameCache(@IntRange(from = 1, to = 8) int capacity)
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 | |
|---|---|
@IntRange(from = 1, to = 8) int capacity |
The capacity of the frame cache, must be greater than zero. |
Public methods
toGlShaderProgram
public GlShaderProgram toGlShaderProgram(Context context, boolean useHdr)
Returns a GlShaderProgram that applies the effect.
| Parameters | |
|---|---|
Context context |
A |
boolean useHdr |
Whether input textures come from an HDR source. If |
| Throws | |
|---|---|
androidx.media3.common.VideoFrameProcessingException |
If an error occurs while creating the |