# VideoFrameProcessor

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/VideoFrameProcessor.java+class:androidx.media3.common.VideoFrameProcessor)

*** ** * ** ***

<br />

```
@UnstableApi
public interface VideoFrameProcessor
```

<br />

Known direct subclasses [DefaultVideoFrameProcessor](https://developer.android.com/reference/androidx/media3/effect/DefaultVideoFrameProcessor)

|---|---|
| `https://developer.android.com/reference/androidx/media3/effect/DefaultVideoFrameProcessor` | A `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` implementation that applies `https://developer.android.com/reference/androidx/media3/effect/GlEffect` instances using OpenGL on a background thread. |

*** ** * ** ***

Interface for a video frame processor that applies changes to individual video frames.

The changes are specified by `https://developer.android.com/reference/androidx/media3/common/Effect` instances passed to `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)`.

Manages its input `https://developer.android.com/reference/android/view/Surface.html`, which can be accessed via `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#getInputSurface()`. The output `https://developer.android.com/reference/android/view/Surface.html` must be set by the caller using `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#setOutputSurfaceInfo(androidx.media3.common.SurfaceInfo)`.

`VideoFrameProcessor` instances can be created from any thread, but instance methods for each `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)` must be called from the same thread.

## Summary

| ### Nested types |
|---|
| `public interface https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Factory` A factory for `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` instances. |
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.InputType` Specifies how the input frames are made available to the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor`. |
| `public interface https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener` Listener for asynchronous frame processing events. |

| ### Constants |
|---|---|
| `default static final long` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#DROP_OUTPUT_FRAME() = -2` Indicates the frame should be dropped after `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#renderOutputFrame(long)` is invoked. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_BITMAP() = 2` Input frames come from a `https://developer.android.com/reference/android/graphics/Bitmap.html`. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE() = 1` Input frames come from a `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#getInputSurface()`. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE_AUTOMATIC_FRAME_REGISTRATION() = 4` Input frames come from the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#getInputSurface()` and don't need to be `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputFrame()` (unlike with `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE()`). |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_TEXTURE_ID() = 3` Input frames come from a `https://developer.android.com/reference/android/opengl/GLES10.html#GL_TEXTURE_2D`. |
| `default static final https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/androidx/media3/common/Effect>` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#REDRAW()` A marker for passing to `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)` to signal a redraw. |
| `default static final long` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#RENDER_OUTPUT_FRAME_IMMEDIATELY() = -1` **This field is deprecated.** Pass `https://developer.android.com/reference/androidx/media3/common/util/SystemClock#nanoTime()` to `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#renderOutputFrame(long)` to render an output frame immediately. <br /> |
| `default static final long` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#RENDER_OUTPUT_FRAME_WITH_PRESENTATION_TIME() = -3` Indicates the frame should preserve the input presentation time when `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#renderOutputFrame(long)` is invoked. |

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#flush()()` Flushes the `VideoFrameProcessor`. |
| `abstract https://developer.android.com/reference/android/view/Surface.html` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#getInputSurface()()` Returns the input `https://developer.android.com/reference/android/view/Surface.html`, where `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` consumes input frames from. |
| `abstract int` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#getPendingInputFrameCount()()` Returns the number of input frames that have been made available to the ` VideoFrameProcessor` but have not been processed yet. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#queueInputBitmap(android.graphics.Bitmap,androidx.media3.common.util.TimestampIterator)( https://developer.android.com/reference/android/graphics/Bitmap.html inputBitmap, https://developer.android.com/reference/androidx/media3/common/util/TimestampIterator timestampIterator )` Provides an input `https://developer.android.com/reference/android/graphics/Bitmap.html` to the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor`. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#queueInputTexture(int,long)(int textureId, long presentationTimeUs)` Provides an input texture ID to the `VideoFrameProcessor`. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#redraw()()` Updates an `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener#onOutputFrameAvailableForRendering(long,boolean)` with the modified effects. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputFrame()()` Informs the `VideoFrameProcessor` that a frame will be queued to its `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#getInputSurface()`. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)( @https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.InputType int inputType, https://developer.android.com/reference/androidx/media3/common/Format format, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Effect> effects, long offsetToAddUs )` Informs the `VideoFrameProcessor` that a new input stream will be queued with the list of `https://developer.android.com/reference/androidx/media3/common/Effect` to apply to the new input stream. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#release()()` Releases all resources. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#renderOutputFrame(long)(long renderTimeNs)` Renders the oldest unrendered output frame that has become `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener#onOutputFrameAvailableForRendering(long,boolean)` at the given `renderTimeNs`. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#setOnInputFrameProcessedListener(androidx.media3.common.OnInputFrameProcessedListener)( https://developer.android.com/reference/androidx/media3/common/OnInputFrameProcessedListener listener )` Sets the `https://developer.android.com/reference/androidx/media3/common/OnInputFrameProcessedListener`. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#setOnInputSurfaceReadyListener(java.lang.Runnable)(https://developer.android.com/reference/java/lang/Runnable.html listener)` Sets a listener that's called when the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#getInputSurface()` is ready to use. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#setOutputSurfaceInfo(androidx.media3.common.SurfaceInfo)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/SurfaceInfo outputSurfaceInfo)` Sets the output surface and supporting information. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#signalEndOfInput()()` Informs the `VideoFrameProcessor` that no further input frames should be accepted. |

## Constants

### DROP_OUTPUT_FRAME

```
default static final long DROP_OUTPUT_FRAME = -2
```

Indicates the frame should be dropped after `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#renderOutputFrame(long)` is invoked.

### INPUT_TYPE_BITMAP

```
default static final int INPUT_TYPE_BITMAP = 2
```

Input frames come from a `https://developer.android.com/reference/android/graphics/Bitmap.html`.

### INPUT_TYPE_SURFACE

```
default static final int INPUT_TYPE_SURFACE = 1
```

Input frames come from a `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#getInputSurface()`.

When receiving input from a Surface, the caller must `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputFrame()` input frames before rendering them to the input `https://developer.android.com/reference/android/view/Surface.html`.

### INPUT_TYPE_SURFACE_AUTOMATIC_FRAME_REGISTRATION

```
default static final int INPUT_TYPE_SURFACE_AUTOMATIC_FRAME_REGISTRATION = 4
```

Input frames come from the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#getInputSurface()` and don't need to be `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputFrame()` (unlike with `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE()`).

Every frame must use the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)` frame format. Also sets the surface's `https://developer.android.com/reference/android/graphics/SurfaceTexture.html#setDefaultBufferSize(int, int)`.

### INPUT_TYPE_TEXTURE_ID

```
default static final int INPUT_TYPE_TEXTURE_ID = 3
```

Input frames come from a `https://developer.android.com/reference/android/opengl/GLES10.html#GL_TEXTURE_2D`.

### REDRAW

```
default static final ImmutableList<Effect> REDRAW
```

A marker for passing to `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)` to signal a redraw.

### RENDER_OUTPUT_FRAME_IMMEDIATELY

```
default static final long RENDER_OUTPUT_FRAME_IMMEDIATELY = -1
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Pass `https://developer.android.com/reference/androidx/media3/common/util/SystemClock#nanoTime()` to `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#renderOutputFrame(long)` to render an output frame immediately.

### RENDER_OUTPUT_FRAME_WITH_PRESENTATION_TIME

```
default static final long RENDER_OUTPUT_FRAME_WITH_PRESENTATION_TIME = -3
```

Indicates the frame should preserve the input presentation time when `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#renderOutputFrame(long)` is invoked.

## Public methods

### flush

```
abstract void flush()
```

Flushes the `VideoFrameProcessor`.

All the frames that are `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputFrame()` prior to calling this method are no longer considered to be registered when this method returns.

`https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener` methods invoked prior to calling this method should be ignored.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | If the `VideoFrameProcessor` does not accept `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE()`. |

### getInputSurface

```
abstract Surface getInputSurface()
```

Returns the input `https://developer.android.com/reference/android/view/Surface.html`, where `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` consumes input frames from.

The frames arriving on the `https://developer.android.com/reference/android/view/Surface.html` will not be consumed by the ` VideoFrameProcessor` until `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)` is called with `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE()`.

For streams with `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE()`, the returned surface is ready to use immediately and will not have a `https://developer.android.com/reference/android/graphics/SurfaceTexture.html#setDefaultBufferSize(int, int)` set on it. This is suitable for configuring a `https://developer.android.com/reference/android/media/MediaCodec.html` decoder.

For streams with `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE_AUTOMATIC_FRAME_REGISTRATION()`, set a listener for the surface becoming ready via `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#setOnInputSurfaceReadyListener(java.lang.Runnable)` and wait for the event before using the returned surface. This is suitable for use with non-decoder producers like media projection.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | If the `VideoFrameProcessor` does not accept `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE()`. |

### getPendingInputFrameCount

```
abstract int getPendingInputFrameCount()
```

Returns the number of input frames that have been made available to the ` VideoFrameProcessor` but have not been processed yet.

### queueInputBitmap

```
abstract boolean queueInputBitmap(
    Bitmap inputBitmap,
    TimestampIterator timestampIterator
)
```

Provides an input `https://developer.android.com/reference/android/graphics/Bitmap.html` to the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor`.

Can be called many times after `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)` to put multiple frames in the same input stream.

An implementation could `https://developer.android.com/reference/android/graphics/Bitmap.html#recycle()` the passed in `https://developer.android.com/reference/android/graphics/Bitmap.html`, so it may not be suitable for reuse.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/graphics/Bitmap.html inputBitmap` | The `https://developer.android.com/reference/android/graphics/Bitmap.html` queued to the `VideoFrameProcessor`. |
| `https://developer.android.com/reference/androidx/media3/common/util/TimestampIterator timestampIterator` | A `https://developer.android.com/reference/androidx/media3/common/util/TimestampIterator` generating the exact timestamps that the bitmap should be shown at. |

| Returns |
|---|---|
| `boolean` | Whether the `https://developer.android.com/reference/android/graphics/Bitmap.html` was successfully queued. A return value of `false` indicates the `VideoFrameProcessor` is not ready to accept input. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | If the `VideoFrameProcessor` does not accept `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_BITMAP()`. |

### queueInputTexture

```
abstract boolean queueInputTexture(int textureId, long presentationTimeUs)
```

Provides an input texture ID to the `VideoFrameProcessor`.

It must be only called after `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#setOnInputFrameProcessedListener(androidx.media3.common.OnInputFrameProcessedListener)` and `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)` have been called.

| Parameters |
|---|---|
| `int textureId` | The ID of the texture queued to the `VideoFrameProcessor`. |
| `long presentationTimeUs` | The presentation time of the queued texture, in microseconds. |

| Returns |
|---|---|
| `boolean` | Whether the texture was successfully queued. A return value of `false` indicates the `VideoFrameProcessor` is not ready to accept input. |

### redraw

```
abstract void redraw()
```

Updates an `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener#onOutputFrameAvailableForRendering(long,boolean)` with the modified effects.

This method can be called from any thread.

### registerInputFrame

```
abstract boolean registerInputFrame()
```

Informs the `VideoFrameProcessor` that a frame will be queued to its `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#getInputSurface()`.

Must be called before rendering a frame to the input surface. The caller must not render frames to the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#getInputSurface()` when `false` is returned.

| Returns |
|---|---|
| `boolean` | Whether the input frame was successfully registered. If `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)` is called, this method returns `false` until `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener#onInputStreamRegistered(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>)` is called. Otherwise, a return value of `false` indicates the `VideoFrameProcessor` is not ready to accept input. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | If the `VideoFrameProcessor` does not accept `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE()`. |
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If called after `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#signalEndOfInput()` or before `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)`. |

### registerInputStream

```
abstract void registerInputStream(
    @VideoFrameProcessor.InputType int inputType,
    Format format,
    List<Effect> effects,
    long offsetToAddUs
)
```

Informs the `VideoFrameProcessor` that a new input stream will be queued with the list of `https://developer.android.com/reference/androidx/media3/common/Effect` to apply to the new input stream.

After registering the first input stream, this method must only be called after the last frame of the already-registered input stream has been `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputFrame()`, last bitmap `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#queueInputBitmap(android.graphics.Bitmap,androidx.media3.common.util.TimestampIterator)` or last texture id `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#queueInputTexture(int,long)`.

This method blocks the calling thread until the previous calls to this method finish, that is when `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener#onInputStreamRegistered(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>)` is called after the underlying processing pipeline has been adapted to the registered input stream.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.InputType int inputType` | The `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.InputType` of the new input stream. |
| `https://developer.android.com/reference/androidx/media3/common/Format format` | The `https://developer.android.com/reference/androidx/media3/common/Format` of the new input stream. The `https://developer.android.com/reference/androidx/media3/common/Format#colorInfo()`, the `https://developer.android.com/reference/androidx/media3/common/Format#width()`, the `https://developer.android.com/reference/androidx/media3/common/Format#height()` and the `https://developer.android.com/reference/androidx/media3/common/Format#pixelWidthHeightRatio()` must be set. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Effect> effects` | The list of `https://developer.android.com/reference/androidx/media3/common/Effect` to apply to the new input stream. |
| `long offsetToAddUs` | The offset that must be added to the frame presentation timestamps, in microseconds. This offset is not part of the input timestamps. It is added to the frame timestamps before processing, and is retained in the output timestamps. |

### release

```
abstract void release()
```

Releases all resources.

If the `VideoFrameProcessor` is released before it has `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener#onEnded()`, it will attempt to cancel processing any input frames that have already become available. Input frames that become available after release are ignored.

This method blocks until all resources are released or releasing times out.

This `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` instance must not be used after this method is called.

### renderOutputFrame

```
abstract void renderOutputFrame(long renderTimeNs)
```

Renders the oldest unrendered output frame that has become `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener#onOutputFrameAvailableForRendering(long,boolean)` at the given `renderTimeNs`.

This will either render the output frame to the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#setOutputSurfaceInfo(androidx.media3.common.SurfaceInfo)`, or drop the frame, per `renderTimeNs`.

This method must only be called if `renderFramesAutomatically` was set to ` false` using the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Factory` and should be called exactly once for each frame that becomes `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener#onOutputFrameAvailableForRendering(long,boolean)`.

The `renderTimeNs` may be passed to `https://developer.android.com/reference/android/opengl/EGLExt.html#eglPresentationTimeANDROID(android.opengl.EGLDisplay, android.opengl.EGLSurface, long)` depending on the implementation.

| Parameters |
|---|---|
| `long renderTimeNs` | The render time to use for the frame, in nanoseconds. The render time can be before or after the current system time. Use `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#DROP_OUTPUT_FRAME()` to drop the frame or `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#RENDER_OUTPUT_FRAME_WITH_PRESENTATION_TIME()` to render the frame to the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#setOutputSurfaceInfo(androidx.media3.common.SurfaceInfo)` with the presentation timestamp seen in `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener#onOutputFrameAvailableForRendering(long,boolean)`. If the frame should be rendered immediately, pass in `https://developer.android.com/reference/androidx/media3/common/util/SystemClock#nanoTime()`. |

### setOnInputFrameProcessedListener

```
abstract void setOnInputFrameProcessedListener(
    OnInputFrameProcessedListener listener
)
```

Sets the `https://developer.android.com/reference/androidx/media3/common/OnInputFrameProcessedListener`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/OnInputFrameProcessedListener listener` | The `https://developer.android.com/reference/androidx/media3/common/OnInputFrameProcessedListener`. |

### setOnInputSurfaceReadyListener

```
abstract void setOnInputSurfaceReadyListener(Runnable listener)
```

Sets a listener that's called when the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#getInputSurface()` is ready to use.

### setOutputSurfaceInfo

```
abstract void setOutputSurfaceInfo(@Nullable SurfaceInfo outputSurfaceInfo)
```

Sets the output surface and supporting information. When output frames are rendered and not dropped, they will be rendered to this output `https://developer.android.com/reference/androidx/media3/common/SurfaceInfo`.

The new output `https://developer.android.com/reference/androidx/media3/common/SurfaceInfo` is applied from the next output frame rendered onwards. If the output `https://developer.android.com/reference/androidx/media3/common/SurfaceInfo` is `null`, the `VideoFrameProcessor` will stop rendering pending frames and resume rendering once a non-null `https://developer.android.com/reference/androidx/media3/common/SurfaceInfo` is set.

If the dimensions given in `https://developer.android.com/reference/androidx/media3/common/SurfaceInfo` do not match the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener#onOutputSizeChanged(int,int)` the frames are resized before rendering to the surface and letter/pillar-boxing is applied.

The caller is responsible for tracking the lifecycle of the `https://developer.android.com/reference/androidx/media3/common/SurfaceInfo#surface()` including calling this method with a new surface if it is destroyed. When this method returns, the previous output surface is no longer being used and can safely be released by the caller.

### signalEndOfInput

```
abstract void signalEndOfInput()
```

Informs the `VideoFrameProcessor` that no further input frames should be accepted.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If called more than once. |