# 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
class VideoFrameProcessorTestRunner
```

<br />

*** ** * ** ***

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

## Summary

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

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/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/kotlin/androidx/media3/common/VideoFrameProcessor` instance's input surface and the `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor` to finish processing the frame, in milliseconds. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner#awaitFrameProcessingEnd(long)(videoFrameProcessingWaitMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` After `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner#signalEndOfInput()`, is called, wait for this instance to end. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/common/util/TimestampIterator!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner#createTimestampIterator(java.util.List<java.lang.Long>)(elements: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html!>!)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner#endFrameProcessing()()` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner#endFrameProcessing(long)` with `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner#VIDEO_FRAME_PROCESSING_WAIT_MS()` applied. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner#endFrameProcessing(long)(videoFrameProcessingWaitMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Ends `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor` frame processing. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner#flush()()` Calls `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#flush()`. |
| `https://developer.android.com/reference/android/graphics/Bitmap.html!` | `https://developer.android.com/reference/kotlin/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/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner.BitmapReader`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner#processFirstFrameAndEnd()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner#queueInputBitmap(android.graphics.Bitmap,long,long,float)( inputBitmap: https://developer.android.com/reference/android/graphics/Bitmap.html!, durationUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, offsetToAddUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, frameRate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner#queueInputBitmap(android.graphics.Bitmap,long,long,float,androidx.media3.common.ColorInfo)( inputBitmap: https://developer.android.com/reference/android/graphics/Bitmap.html!, durationUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, offsetToAddUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, frameRate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, colorInfo: https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo! )` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/java/lang/SafeVarargs.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner#queueInputBitmaps(int,int,android.util.Pair<android.graphics.Bitmap,androidx.media3.common.util.TimestampIterator>...)( width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, frames: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/android/util/Pair.html<https://developer.android.com/reference/android/graphics/Bitmap.html!, https://developer.android.com/reference/kotlin/androidx/media3/common/util/TimestampIterator!>!>! )` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/java/lang/SafeVarargs.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner#queueInputBitmaps(int,int,androidx.media3.common.ColorInfo,android.util.Pair<android.graphics.Bitmap,androidx.media3.common.util.TimestampIterator>...)( width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, colorInfo: https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo!, frames: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/android/util/Pair.html<https://developer.android.com/reference/android/graphics/Bitmap.html!, https://developer.android.com/reference/kotlin/androidx/media3/common/util/TimestampIterator!>!>! )` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner#queueInputTexture(androidx.media3.common.GlTextureInfo,long,androidx.media3.common.ColorInfo)( inputTexture: https://developer.android.com/reference/kotlin/androidx/media3/common/GlTextureInfo!, pts: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, colorInfo: https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo! )` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner#release()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/VideoFrameProcessorTestRunner#signalEndOfInput()()` Calls `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#signalEndOfInput()`. |

## Constants

### VIDEO_FRAME_PROCESSING_WAIT_MS

```
const val VIDEO_FRAME_PROCESSING_WAIT_MS = 5000: Int
```

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

## Public functions

### awaitFrameProcessingEnd

```
fun awaitFrameProcessingEnd(videoFrameProcessingWaitMs: Long): Unit
```

After `https://developer.android.com/reference/kotlin/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

```
java-static fun createTimestampIterator(elements: (Mutable)List<Long!>!): TimestampIterator!
```

### endFrameProcessing

```
fun endFrameProcessing(): Unit
```

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

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

### endFrameProcessing

```
fun endFrameProcessing(videoFrameProcessingWaitMs: Long): Unit
```

Ends `https://developer.android.com/reference/kotlin/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

```
fun flush(): Unit
```

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

### getOutputBitmap

```
fun getOutputBitmap(): Bitmap!
```

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

Also saves the bitmap to the cache directory.

### processFirstFrameAndEnd

```
fun processFirstFrameAndEnd(): Unit
```

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

### queueInputBitmap

```
fun queueInputBitmap(
    inputBitmap: Bitmap!,
    durationUs: Long,
    offsetToAddUs: Long,
    frameRate: Float
): Unit
```

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

### queueInputBitmap

```
fun queueInputBitmap(
    inputBitmap: Bitmap!,
    durationUs: Long,
    offsetToAddUs: Long,
    frameRate: Float,
    colorInfo: ColorInfo!
): Unit
```

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

### queueInputBitmaps

```
@SafeVarargs
fun queueInputBitmaps(
    width: Int,
    height: Int,
    frames: Array<Pair<Bitmap!, TimestampIterator!>!>!
): Unit
```

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

### queueInputBitmaps

```
@SafeVarargs
fun queueInputBitmaps(
    width: Int,
    height: Int,
    colorInfo: ColorInfo!,
    frames: Array<Pair<Bitmap!, TimestampIterator!>!>!
): Unit
```

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

### queueInputTexture

```
fun queueInputTexture(
    inputTexture: GlTextureInfo!,
    pts: Long,
    colorInfo: ColorInfo!
): Unit
```

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

### release

```
fun release(): Unit
```

### signalEndOfInput

```
fun signalEndOfInput(): Unit
```

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

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