# 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
public final class RandomizedMp3Decoder implements 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/androidx/media3/test/utils/robolectric/RandomizedMp3Decoder#RandomizedMp3Decoder()()` |

| ### Public methods |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<byte[]>` | `https://developer.android.com/reference/androidx/media3/test/utils/robolectric/RandomizedMp3Decoder#getAllOutputBytes()()` Returns all arrays of bytes output from the decoder. |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/robolectric/RandomizedMp3Decoder#onConfigured(android.media.MediaFormat,android.view.Surface,android.media.MediaCrypto,int)( https://developer.android.com/reference/android/media/MediaFormat.html format, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/Surface.html surface, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/media/MediaCrypto.html crypto, int flags )` |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/robolectric/RandomizedMp3Decoder#process(java.nio.ByteBuffer,java.nio.ByteBuffer)(https://developer.android.com/reference/java/nio/ByteBuffer.html in, https://developer.android.com/reference/java/nio/ByteBuffer.html out)` |

## Public constructors

### RandomizedMp3Decoder

```
public RandomizedMp3Decoder()
```

## Public methods

### getAllOutputBytes

```
public ImmutableList<byte[]> getAllOutputBytes()
```

Returns all arrays of bytes output from the decoder.

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

### onConfigured

```
public void onConfigured(
    MediaFormat format,
    @Nullable Surface surface,
    @Nullable MediaCrypto crypto,
    int flags
)
```

### process

```
public void process(ByteBuffer in, ByteBuffer out)
```