# FakeFrameProcessor

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/FakeFrameProcessor.java+class:androidx.media3.test.utils.FakeFrameProcessor)

*** ** * ** ***


```
@ExperimentalApi
public class FakeFrameProcessor implements FrameProcessor
```

<br />

*** ** * ** ***

A fake `https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor` implementation.

## Summary

| ### Nested types |
|---|
| `public class https://developer.android.com/reference/androidx/media3/test/utils/FakeFrameProcessor.Factory implements https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor.Factory` A factory for `https://developer.android.com/reference/androidx/media3/test/utils/FakeFrameProcessor` implementations. |
| `public class https://developer.android.com/reference/androidx/media3/test/utils/FakeFrameProcessor.Listener implements https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor.Listener` A fake `https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor.Listener` implementation for tests. |

| ### Public fields |
|---|---|
| `final https://developer.android.com/reference/java/util/concurrent/atomic/AtomicBoolean.html` | `https://developer.android.com/reference/androidx/media3/test/utils/FakeFrameProcessor#closed()` |
| `final https://developer.android.com/reference/java/util/concurrent/atomic/AtomicBoolean.html` | `https://developer.android.com/reference/androidx/media3/test/utils/FakeFrameProcessor#eosSignaled()` |
| `final https://developer.android.com/reference/androidx/media3/common/video/FrameWriter` | `https://developer.android.com/reference/androidx/media3/test/utils/FakeFrameProcessor#output()` |
| `int` | `https://developer.android.com/reference/androidx/media3/test/utils/FakeFrameProcessor#queuedFramesCount()` |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/FakeFrameProcessor#close()()` Blocks until all resources are released. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/test/utils/FakeFrameProcessor#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. |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/FakeFrameProcessor#signalEndOfStream()()` Notifies this processor that the current stream has ended. |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/FakeFrameProcessor#triggerError(androidx.media3.common.VideoFrameProcessingException)(https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessingException exception)` Simulates a video frame processing error by notifying the listener. |

### Inherited methods

From [java.lang.AutoCloseable](https://developer.android.com/reference/java/lang/AutoCloseable.html) `abstract void` `https://developer.android.com/reference/java/lang/AutoCloseable.html#close()()`

## Public fields

### closed

```
public final AtomicBoolean closed
```

### eosSignaled

```
public final AtomicBoolean eosSignaled
```

### output

```
public final FrameWriter output
```

### queuedFramesCount

```
public int queuedFramesCount
```

## Public methods

### close

```
public void close()
```

Blocks until all resources are released.

### queue

```
public 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

```
public 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.

### triggerError

```
public void triggerError(VideoFrameProcessingException exception)
```

Simulates a video frame processing error by notifying the listener.