# FrameProcessor

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

*** ** * ** ***


```
@ExperimentalApi
public interface FrameProcessor extends AutoCloseable
```

<br />

Known direct subclasses [CapturingFrameProcessor](https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor), [DefaultGlFrameProcessor](https://developer.android.com/reference/androidx/media3/effect/DefaultGlFrameProcessor), [EnhancementSessionDecorator](https://developer.android.com/reference/androidx/media3/effect/playservices/EnhancementSessionDecorator), [FakeFrameProcessor](https://developer.android.com/reference/androidx/media3/test/utils/FakeFrameProcessor)

|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor` | A `https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor` that delegates to an underlying `https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor` and records queued frames and EOS signals for testing. |
| `https://developer.android.com/reference/androidx/media3/effect/DefaultGlFrameProcessor` | A `https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor` implementation that executes a chain of `https://developer.android.com/reference/androidx/media3/effect/GlTextureFrameConsumer`s. |
| `https://developer.android.com/reference/androidx/media3/effect/playservices/EnhancementSessionDecorator` | A `https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor` decorator that routes video frames through Google Play services EnhancementSession. |
| `https://developer.android.com/reference/androidx/media3/test/utils/FakeFrameProcessor` | A fake `https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor` implementation. |

*** ** * ** ***

Consumes `https://developer.android.com/reference/java/util/List.html`, and outputs to a `https://developer.android.com/reference/androidx/media3/common/video/FrameWriter`.

## Summary

| ### Nested types |
|---|
| `public interface https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor.Factory` Factory for FrameProcessor instances. |
| `public interface https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor.Listener` Listener for `https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor` events. |

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor#close()()` Blocks until all resources are released. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor#queue(java.util.List<androidx.media3.common.video.AsyncFrame>)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/video/AsyncFrame> frames)` Attempts to queue a `https://developer.android.com/reference/java/util/List.html` of `https://developer.android.com/reference/androidx/media3/common/video/AsyncFrame` for processing. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor#signalEndOfStream()()` Notifies this processor that the current stream has ended. |

## Public methods

### close

```
abstract void close()
```

Blocks until all resources are released.

### queue

```
abstract boolean queue(List<AsyncFrame> frames)
```

Attempts to queue a `https://developer.android.com/reference/java/util/List.html` of `https://developer.android.com/reference/androidx/media3/common/video/AsyncFrame` for processing.

All frames provided in a single invocation of this method represent the exact same point in time.

If this consumer is at capacity, this method returns `false` and the `https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor.Listener#onWakeup()` will be invoked when capacity becomes available.

If this method returns `true`, `https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor.Listener#onFrameProcessed(androidx.media3.common.video.Frame,androidx.media3.common.video.SyncFenceWrapper)` must be called once with every input `https://developer.android.com/reference/androidx/media3/common/video/AsyncFrame#frame()` instance queued, once the `https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor` has finished processing the `frames`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/video/AsyncFrame> frames` | The frames to queue. |

| Returns |
|---|---|
| `boolean` | `true` if the frames were queued, `false` if the consumer is at capacity. |

### signalEndOfStream

```
abstract void signalEndOfStream()
```

Notifies this processor that the current stream has ended.

More frames may be queued after calling this method, if the current stream changes.