# RecordingPacketConsumer

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

*** ** * ** ***


```
@ExperimentalApi
class RecordingPacketConsumer<T : Any?> : PacketConsumer<T>
```

<br />

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/media3/effect/PacketConsumer` implementation that holds a reference to all queued packets, and optionally releases the underlying frames.

## Summary

| ### Public constructors |
|---|
| `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/media3/test/utils/RecordingPacketConsumer#RecordingPacketConsumer()()` |

| ### Public functions |
|---|---|
| `open suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/RecordingPacketConsumer#queuePacket(androidx.media3.effect.PacketConsumer.Packet)(packet: https://developer.android.com/reference/kotlin/androidx/media3/effect/PacketConsumer.Packet<T>)` Queues a `https://developer.android.com/reference/kotlin/androidx/media3/effect/PacketConsumer.Packet` for processing, suspending the caller if the consumer is at capacity. |
| `open suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/RecordingPacketConsumer#release()()` Releases all resources. |

| ### Public properties |
|---|---|
| `(T) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/RecordingPacketConsumer#onQueue()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/effect/PacketConsumer.Packet<T>>` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/RecordingPacketConsumer#queuedPackets()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<T>` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/RecordingPacketConsumer#queuedPayloads()` |

## Public constructors

### RecordingPacketConsumer

```
<T : Any?> RecordingPacketConsumer()
```

## Public functions

### queuePacket

```
open suspend fun queuePacket(packet: PacketConsumer.Packet<T>): Unit
```

Queues a `https://developer.android.com/reference/kotlin/androidx/media3/effect/PacketConsumer.Packet` for processing, suspending the caller if the consumer is at capacity.

Once this method returns, the ownership of the `https://developer.android.com/reference/kotlin/androidx/media3/effect/PacketConsumer#queuePacket(androidx.media3.effect.PacketConsumer.Packet)` is transferred to this `https://developer.android.com/reference/kotlin/androidx/media3/effect/PacketConsumer`, and the caller should not modify the `https://developer.android.com/reference/kotlin/androidx/media3/effect/PacketConsumer#queuePacket(androidx.media3.effect.PacketConsumer.Packet)`.

| Parameters |
|---|---|
| `packet: https://developer.android.com/reference/kotlin/androidx/media3/effect/PacketConsumer.Packet<T>` | The `https://developer.android.com/reference/kotlin/androidx/media3/effect/PacketConsumer.Packet` to process. |

### release

```
open suspend fun release(): Unit
```

Releases all resources.

## Public properties

### onQueue

```
var onQueue: (T) -> Unit
```

### queuedPackets

```
val queuedPackets: List<PacketConsumer.Packet<T>>
```

### queuedPayloads

```
val queuedPayloads: List<T>
```