Class RandomizedMp3Decoder

  • All Implemented Interfaces:
    org.robolectric.shadows.ShadowMediaCodec.CodecConfig.Codec

    public final class RandomizedMp3Decoder
    extends Object
    implements org.robolectric.shadows.ShadowMediaCodec.CodecConfig.Codec
    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 bahavior 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().

    • Constructor Detail

      • RandomizedMp3Decoder

        public RandomizedMp3Decoder()
    • Method Detail

      • process

        public void process​(ByteBuffer in,
                            ByteBuffer out)
        Specified by:
        process in interface org.robolectric.shadows.ShadowMediaCodec.CodecConfig.Codec
      • onConfigured

        public void onConfigured​(MediaFormat format,
                                 Surface surface,
                                 MediaCrypto crypto,
                                 int flags)
        Specified by:
        onConfigured in interface org.robolectric.shadows.ShadowMediaCodec.CodecConfig.Codec
      • getAllOutputBytes

        public ImmutableList<byte[]> getAllOutputBytes()
        Returns all arrays of bytes output from the decoder.
        Returns:
        a list of byte arrays (for each MP3 frame input) that were previously output from the decoder.