mirror of
https://github.com/androidx/media.git
synced 2025-05-12 10:09:55 +08:00
AudioCapabilities: Missing int class annotation
PiperOrigin-RevId: 293565660
This commit is contained in:
parent
04af8e60ba
commit
9875c5d2b4
@ -18,6 +18,7 @@ package com.google.android.exoplayer2;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.media.AudioFormat;
|
||||
import android.media.MediaCodec;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import org.junit.Test;
|
||||
@ -36,4 +37,12 @@ public class CTest {
|
||||
assertThat(C.CRYPTO_MODE_AES_CTR).isEqualTo(MediaCodec.CRYPTO_MODE_AES_CTR);
|
||||
}
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
@Test
|
||||
public void testEncodingConstants() {
|
||||
// Sanity check that encoding constant values match those defined by the platform.
|
||||
assertThat(C.ENCODING_PCM_16BIT).isEqualTo(AudioFormat.ENCODING_PCM_16BIT);
|
||||
assertThat(C.ENCODING_MP3).isEqualTo(AudioFormat.ENCODING_MP3);
|
||||
assertThat(C.ENCODING_PCM_FLOAT).isEqualTo(AudioFormat.ENCODING_PCM_FLOAT);
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import android.media.AudioManager;
|
||||
import android.net.Uri;
|
||||
import android.provider.Settings.Global;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import java.util.Arrays;
|
||||
|
||||
@ -115,10 +116,10 @@ public final class AudioCapabilities {
|
||||
/**
|
||||
* Returns whether this device supports playback of the specified audio {@code encoding}.
|
||||
*
|
||||
* @param encoding One of {@link android.media.AudioFormat}'s {@code ENCODING_*} constants.
|
||||
* @param encoding One of {@link C.Encoding}'s {@code ENCODING_*} constants.
|
||||
* @return Whether this device supports playback the specified audio {@code encoding}.
|
||||
*/
|
||||
public boolean supportsEncoding(int encoding) {
|
||||
public boolean supportsEncoding(@C.Encoding int encoding) {
|
||||
return Arrays.binarySearch(supportedEncodings, encoding) >= 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user