# CapturingFrameProcessor

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

*** ** * ** ***


```
@RequiresApi(value = 26)
@ExperimentalApi
public class CapturingFrameProcessor implements FrameProcessor
```

<br />

*** ** * ** ***

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.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor.EosEvent implements https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor.Event` Marker class representing a `https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor#signalEndOfStream()` call. |
| `public interface https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor.Event` Marker interface for ordering frames and EOS signals. |
| `public class https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor.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/CapturingFrameProcessor` instances. |
| `public final class https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor.FramesEvent implements https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor.Event` Holds the frames queued in a `https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor#queue(java.util.List<androidx.media3.common.video.AsyncFrame>)` call. |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor#close()()` Blocks until all resources are released. |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/java/lang/Long.html>>` | `https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor#getQueuedContentTimesUs()()` Returns a list of timestamp lists for all queued events. |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor.Event>` | `https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor#getQueuedEvents()()` Returns an `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html` of all queued events. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor#isEnded()()` Returns true if the last `https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor.Event` queued was an `https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor.EosEvent`. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor#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/CapturingFrameProcessor#signalEndOfStream()()` Notifies this processor that the current stream has ended. |

### 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 methods

### close

```
public void close()
```

Blocks until all resources are released.

### getQueuedContentTimesUs

```
public ImmutableList<ImmutableList<Long>> getQueuedContentTimesUs()
```

Returns a list of timestamp lists for all queued events. The list for an EOS event contains a single `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` value.

### getQueuedEvents

```
public ImmutableList<CapturingFrameProcessor.Event> getQueuedEvents()
```

Returns an `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html` of all queued events.

### isEnded

```
public boolean isEnded()
```

Returns true if the last `https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor.Event` queued was an `https://developer.android.com/reference/androidx/media3/test/utils/CapturingFrameProcessor.EosEvent`.

### 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.