# VideoFrameProcessorTestRunner

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

*** ** * ** ***

<br />

```
@UnstableApi
public final class VideoFrameProcessorTestRunner
```

<br />

*** ** * ** ***

A test runner for `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` tests.

## Summary

| ### Nested types |
|---|
| `public interface https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner.BitmapReader` Reads a `https://developer.android.com/reference/android/graphics/Bitmap.html` from `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` output. |
| `public final class https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner.Builder` A builder for `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner` instances. |
| `public interface https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner.OnOutputFrameAvailableForRenderingListener` |
| `public interface https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner.OnVideoFrameProcessingEndedListener` |
| `public final class https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner.SurfaceBitmapReader implements https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner.BitmapReader` Reads from a `https://developer.android.com/reference/android/view/Surface.html`. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#VIDEO_FRAME_PROCESSING_WAIT_MS() = 5000` Time to wait for the decoded frame to populate the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` instance's input surface and the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` to finish processing the frame, in milliseconds. |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#awaitFrameProcessingEnd(long)(long videoFrameProcessingWaitMs)` After `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#signalEndOfInput()`, is called, wait for this instance to end. |
| `static https://developer.android.com/reference/androidx/media3/common/util/TimestampIterator` | `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#createTimestampIterator(java.util.List<java.lang.Long>)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/Long.html> elements)` |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#endFrameProcessing()()` `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#endFrameProcessing(long)` with `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#VIDEO_FRAME_PROCESSING_WAIT_MS()` applied. |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#endFrameProcessing(long)(long videoFrameProcessingWaitMs)` Ends `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` frame processing. |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#flush()()` Calls `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#flush()`. |
| `https://developer.android.com/reference/android/graphics/Bitmap.html` | `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#getOutputBitmap()()` Returns the `https://developer.android.com/reference/android/graphics/Bitmap.html` from the provided `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner.BitmapReader`. |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#processFirstFrameAndEnd()()` |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#queueInputBitmap(android.graphics.Bitmap,long,long,float)( https://developer.android.com/reference/android/graphics/Bitmap.html inputBitmap, long durationUs, long offsetToAddUs, float frameRate )` |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#queueInputBitmap(android.graphics.Bitmap,long,long,float,androidx.media3.common.ColorInfo)( https://developer.android.com/reference/android/graphics/Bitmap.html inputBitmap, long durationUs, long offsetToAddUs, float frameRate, https://developer.android.com/reference/androidx/media3/common/ColorInfo colorInfo )` |
| `final void` | `@https://developer.android.com/reference/java/lang/SafeVarargs.html https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#queueInputBitmaps(int,int,android.util.Pair<android.graphics.Bitmap,androidx.media3.common.util.TimestampIterator>...)(int width, int height, Pair[] frames)` |
| `final void` | `@https://developer.android.com/reference/java/lang/SafeVarargs.html https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#queueInputBitmaps(int,int,androidx.media3.common.ColorInfo,android.util.Pair<android.graphics.Bitmap,androidx.media3.common.util.TimestampIterator>...)( int width, int height, https://developer.android.com/reference/androidx/media3/common/ColorInfo colorInfo, Pair[] frames )` |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#queueInputTexture(androidx.media3.common.GlTextureInfo,long,androidx.media3.common.ColorInfo)( https://developer.android.com/reference/androidx/media3/common/GlTextureInfo inputTexture, long pts, https://developer.android.com/reference/androidx/media3/common/ColorInfo colorInfo )` |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#release()()` |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#signalEndOfInput()()` Calls `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#signalEndOfInput()`. |

## Constants

### VIDEO_FRAME_PROCESSING_WAIT_MS

```
public static final int VIDEO_FRAME_PROCESSING_WAIT_MS = 5000
```

Time to wait for the decoded frame to populate the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` instance's input surface and the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` to finish processing the frame, in milliseconds.

## Public methods

### awaitFrameProcessingEnd

```
public void awaitFrameProcessingEnd(long videoFrameProcessingWaitMs)
```

After `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#signalEndOfInput()`, is called, wait for this instance to end.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/Exception.html` |   |

### createTimestampIterator

```
public static TimestampIterator createTimestampIterator(List<Long> elements)
```

### endFrameProcessing

```
public void endFrameProcessing()
```

`https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#endFrameProcessing(long)` with `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#VIDEO_FRAME_PROCESSING_WAIT_MS()` applied.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/Exception.html` |   |

### endFrameProcessing

```
public void endFrameProcessing(long videoFrameProcessingWaitMs)
```

Ends `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` frame processing.

Waits for frame processing to end, for `videoFrameProcessingWaitMs`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/Exception.html` |   |

### flush

```
public void flush()
```

Calls `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#flush()`.

### getOutputBitmap

```
public Bitmap getOutputBitmap()
```

Returns the `https://developer.android.com/reference/android/graphics/Bitmap.html` from the provided `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner.BitmapReader`.

Also saves the bitmap to the cache directory.

### processFirstFrameAndEnd

```
public void processFirstFrameAndEnd()
```

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/Exception.html` |   |

### queueInputBitmap

```
public void queueInputBitmap(
    Bitmap inputBitmap,
    long durationUs,
    long offsetToAddUs,
    float frameRate
)
```

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessingException` |   |

### queueInputBitmap

```
public void queueInputBitmap(
    Bitmap inputBitmap,
    long durationUs,
    long offsetToAddUs,
    float frameRate,
    ColorInfo colorInfo
)
```

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessingException` |   |

### queueInputBitmaps

```
@SafeVarargs
public final void queueInputBitmaps(int width, int height, Pair[] frames)
```

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessingException` |   |

### queueInputBitmaps

```
@SafeVarargs
public final void queueInputBitmaps(
    int width,
    int height,
    ColorInfo colorInfo,
    Pair[] frames
)
```

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessingException` |   |

### queueInputTexture

```
public void queueInputTexture(
    GlTextureInfo inputTexture,
    long pts,
    ColorInfo colorInfo
)
```

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessingException` |   |

### release

```
public void release()
```

### signalEndOfInput

```
public void signalEndOfInput()
```

Calls `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#signalEndOfInput()`.

Calling this and `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#awaitFrameProcessingEnd(long)` is an alternative to `https://developer.android.com/reference/androidx/media3/test/utils/VideoFrameProcessorTestRunner#endFrameProcessing()`.