# RandomizedMp3Decoder

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

*** ** * ** ***

<br />

```
@UnstableApi
class RandomizedMp3Decoder : ShadowMediaCodec.CodecConfig.Codec
```

<br />

*** ** * ** ***

Generates randomized, but correct amount of data on MP3 audio input.

The decoder reads the MP3 header for each input MP3 frame, determines the number of bytes the input frame should inflate to, and writes randomized data of that amount to the output buffer. Decoder randomness can help us identify possible errors in downstream renderers and audio processors. The random behavior is deterministic, it outputs the same bytes across multiple runs.

All the data written to the output by the decoder can be obtained by getAllOutputBytes().

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/RandomizedMp3Decoder#RandomizedMp3Decoder()()` |

| ### Public functions |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/RandomizedMp3Decoder#getAllOutputBytes()()` Returns all arrays of bytes output from the decoder. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/RandomizedMp3Decoder#onConfigured(android.media.MediaFormat,android.view.Surface,android.media.MediaCrypto,int)( format: https://developer.android.com/reference/android/media/MediaFormat.html!, surface: https://developer.android.com/reference/android/view/Surface.html?, crypto: https://developer.android.com/reference/android/media/MediaCrypto.html?, flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/RandomizedMp3Decoder#process(java.nio.ByteBuffer,java.nio.ByteBuffer)(in: https://developer.android.com/reference/java/nio/ByteBuffer.html!, out: https://developer.android.com/reference/java/nio/ByteBuffer.html!)` |

## Public constructors

### RandomizedMp3Decoder

```
RandomizedMp3Decoder()
```

## Public functions

### getAllOutputBytes

```
fun getAllOutputBytes(): ImmutableList<Array<Byte>!>!
```

Returns all arrays of bytes output from the decoder.

| Returns |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!>!` | a list of byte arrays (for each MP3 frame input) that were previously output from the decoder. |

### onConfigured

```
fun onConfigured(
    format: MediaFormat!,
    surface: Surface?,
    crypto: MediaCrypto?,
    flags: Int
): Unit
```

### process

```
fun process(in: ByteBuffer!, out: ByteBuffer!): Unit
```