Commit f69e4be4 by ibaker Committed by kim-vde

Add @RequiresApi(29) to RandomizedMp3Decoder

This is needed for the MediaFormat#getInteger calls in onConfigured().

The end-to-end playback tests this is used for have to run on API 29
anyway (because of ShadowMediaCodec and ShadowMediaCodecList
functionality).

#minor-release

PiperOrigin-RevId: 353858622
parent ccf031f9
...@@ -20,6 +20,7 @@ import android.media.AudioFormat; ...@@ -20,6 +20,7 @@ import android.media.AudioFormat;
import android.media.MediaCrypto; import android.media.MediaCrypto;
import android.media.MediaFormat; import android.media.MediaFormat;
import android.view.Surface; import android.view.Surface;
import androidx.annotation.RequiresApi;
import com.google.android.exoplayer2.audio.MpegAudioUtil; import com.google.android.exoplayer2.audio.MpegAudioUtil;
import com.google.android.exoplayer2.testutil.TestUtil; import com.google.android.exoplayer2.testutil.TestUtil;
import com.google.android.exoplayer2.util.Assertions; import com.google.android.exoplayer2.util.Assertions;
...@@ -41,6 +42,7 @@ import org.robolectric.shadows.ShadowMediaCodec; ...@@ -41,6 +42,7 @@ import org.robolectric.shadows.ShadowMediaCodec;
* *
* <p>All the data written to the output by the decoder can be obtained by getAllOutputBytes(). * <p>All the data written to the output by the decoder can be obtained by getAllOutputBytes().
*/ */
@RequiresApi(29)
public final class RandomizedMp3Decoder implements ShadowMediaCodec.CodecConfig.Codec { public final class RandomizedMp3Decoder implements ShadowMediaCodec.CodecConfig.Codec {
private final List<byte[]> decoderOutput = new ArrayList<>(); private final List<byte[]> decoderOutput = new ArrayList<>();
private int frameSizeInBytes; private int frameSizeInBytes;
...@@ -70,9 +72,6 @@ public final class RandomizedMp3Decoder implements ShadowMediaCodec.CodecConfig. ...@@ -70,9 +72,6 @@ public final class RandomizedMp3Decoder implements ShadowMediaCodec.CodecConfig.
@Override @Override
public void onConfigured(MediaFormat format, Surface surface, MediaCrypto crypto, int flags) { public void onConfigured(MediaFormat format, Surface surface, MediaCrypto crypto, int flags) {
// Both getInteger and getString require API29. This class is only used in EndToEndGaplessTest
// that only runs on
// API29.
int pcmEncoding = int pcmEncoding =
format.getInteger( format.getInteger(
MediaFormat.KEY_PCM_ENCODING, /* defaultValue= */ AudioFormat.ENCODING_PCM_16BIT); MediaFormat.KEY_PCM_ENCODING, /* defaultValue= */ AudioFormat.ENCODING_PCM_16BIT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment