mirror of
https://github.com/samsonjs/media.git
synced 2026-04-08 11:45:51 +00:00
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
This commit is contained in:
parent
ccf031f9bb
commit
f69e4be40e
1 changed files with 2 additions and 3 deletions
|
|
@ -20,6 +20,7 @@ import android.media.AudioFormat;
|
|||
import android.media.MediaCrypto;
|
||||
import android.media.MediaFormat;
|
||||
import android.view.Surface;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import com.google.android.exoplayer2.audio.MpegAudioUtil;
|
||||
import com.google.android.exoplayer2.testutil.TestUtil;
|
||||
import com.google.android.exoplayer2.util.Assertions;
|
||||
|
|
@ -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().
|
||||
*/
|
||||
@RequiresApi(29)
|
||||
public final class RandomizedMp3Decoder implements ShadowMediaCodec.CodecConfig.Codec {
|
||||
private final List<byte[]> decoderOutput = new ArrayList<>();
|
||||
private int frameSizeInBytes;
|
||||
|
|
@ -70,9 +72,6 @@ public final class RandomizedMp3Decoder implements ShadowMediaCodec.CodecConfig.
|
|||
|
||||
@Override
|
||||
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 =
|
||||
format.getInteger(
|
||||
MediaFormat.KEY_PCM_ENCODING, /* defaultValue= */ AudioFormat.ENCODING_PCM_16BIT);
|
||||
|
|
|
|||
Loading…
Reference in a new issue