# GlTextureFrame

Artifact: [androidx.media3:media3-effect](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/effect/GlTextureFrame.java+class:androidx.media3.effect.GlTextureFrame)

*** ** * ** ***


```
@ExperimentalApi
class GlTextureFrame
```

<br />

*** ** * ** ***

A frame that wraps a `https://developer.android.com/reference/kotlin/androidx/media3/common/GlTextureInfo`.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame.Builder` A builder for `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame` instances. |

| ### Constants |
|---|---|
| `const https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame#END_OF_STREAM_FRAME()` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame.Builder!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame#buildUpon()()` Returns a `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame.Builder` initialized with the values of this instance. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame#release(androidx.media3.common.video.SyncFenceWrapper)(releaseFence: https://developer.android.com/reference/kotlin/androidx/media3/common/video/SyncFenceWrapper?)` Releases the frame and its underlying resources. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame#retain()()` Increases the reference count of this frame. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame#fenceSync()` The OpenGL fence sync object (a `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createGlSyncFence()` handle) associated with this frame. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame#format()` The format of the frame. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/GlTextureInfo!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame#glTextureInfo()` The `https://developer.android.com/reference/kotlin/androidx/media3/common/GlTextureInfo`. |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame#metadata()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame#presentationTimeUs()` The presentation time of the frame, in microseconds. |
| `https://developer.android.com/reference/java/util/function/Consumer.html<https://developer.android.com/reference/kotlin/androidx/media3/common/GlTextureInfo!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame#releaseTextureCallback()` The `https://developer.android.com/reference/java/util/function/Consumer.html` to call to release the texture. |
| `https://developer.android.com/reference/java/util/concurrent/Executor.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame#releaseTextureExecutor()` The `https://developer.android.com/reference/java/util/concurrent/Executor.html` on which the `releaseTextureCallback` is called. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame#releaseTimeNs()` The release time of the frame, in nanoseconds. |

## Constants

### END_OF_STREAM_FRAME

```
const val END_OF_STREAM_FRAME: GlTextureFrame!
```

## Public functions

### buildUpon

```
fun buildUpon(): GlTextureFrame.Builder!
```

Returns a `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame.Builder` initialized with the values of this instance.

### release

```
fun release(releaseFence: SyncFenceWrapper?): Unit
```

Releases the frame and its underlying resources.

This implementation is idempotent if called after the frame has already been released. It will strictly release the underlying resources only when the count transitions from 1 to 0.

| Parameters |
|---|---|
| `releaseFence: https://developer.android.com/reference/kotlin/androidx/media3/common/video/SyncFenceWrapper?` | A `https://developer.android.com/reference/kotlin/androidx/media3/common/video/SyncFenceWrapper` that must signal before the underlying resources can be fully released, or `null` if the resources can be released immediately. |

### retain

```
fun retain(): Unit
```

Increases the reference count of this frame. For every call to this method there must be an extra `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame#release(androidx.media3.common.video.SyncFenceWrapper)` call before this frame is released.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if called after the frame has been released. |

## Public properties

### fenceSync

```
val fenceSync: Long
```

The OpenGL fence sync object (a `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#createGlSyncFence()` handle) associated with this frame. See [](https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glFenceSync.xhtml)

If this texture is read in an OpenGL context different to the one it was written to, call `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#awaitSyncObject(long)` on this fence before reading the `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame#glTextureInfo()`, to ensure the contents have been fully written to.

Callers must \*not\* `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#deleteSyncObject(long)` this fence, as it may be reused up until this frame is `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureFrame#release(androidx.media3.common.video.SyncFenceWrapper)`.

The value is `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil#GL_FENCE_SYNC_UNSET()` if no fence has been created for this texture, as it is only expected to be produced and consumed within the same GL command stream.

### format

```
val format: Format!
```

The format of the frame.

### glTextureInfo

```
val glTextureInfo: GlTextureInfo!
```

The `https://developer.android.com/reference/kotlin/androidx/media3/common/GlTextureInfo`.

### metadata

```
val metadata: ImmutableMap<String!, Any!>!
```

### presentationTimeUs

```
val presentationTimeUs: Long
```

The presentation time of the frame, in microseconds.

### releaseTextureCallback

```
val releaseTextureCallback: Consumer<GlTextureInfo!>!
```

The `https://developer.android.com/reference/java/util/function/Consumer.html` to call to release the texture.

### releaseTextureExecutor

```
val releaseTextureExecutor: Executor!
```

The `https://developer.android.com/reference/java/util/concurrent/Executor.html` on which the `releaseTextureCallback` is called.

### releaseTimeNs

```
val releaseTimeNs: Long
```

The release time of the frame, in nanoseconds.