Make the API 34 check inline and refactor the comment
This commit is contained in:
parent
f301214a1e
commit
730cfecd57
@ -17,7 +17,7 @@
|
||||
* Ogg: Fix bug when seeking in files with a long duration
|
||||
([#391](https://github.com/androidx/media/issues/391)).
|
||||
* Audio:
|
||||
* Add direct playback supports for DTS Express and DTS:X
|
||||
* Add direct playback support for DTS Express and DTS:X
|
||||
([#335](https://github.com/androidx/media/pull/335)).
|
||||
* Audio Offload:
|
||||
* Add `AudioSink.getFormatOffloadSupport(Format)` that retrieves level of
|
||||
|
@ -257,7 +257,7 @@ public final class C {
|
||||
@UnstableApi public static final int ENCODING_DTS = AudioFormat.ENCODING_DTS;
|
||||
/** See {@link AudioFormat#ENCODING_DTS_HD}. */
|
||||
@UnstableApi public static final int ENCODING_DTS_HD = AudioFormat.ENCODING_DTS_HD;
|
||||
/** TODO: To replace with AudioFormat.ENCODING_DTS_UHD_P2 when Android 14.0 is released. */
|
||||
// TODO(internal b/283949283): Use AudioFormat.ENCODING_DTS_UHD_P2 when Android 14 is released.
|
||||
@UnstableApi public static final int ENCODING_DTS_UHD_P2 = 0x0000001e;
|
||||
/** See {@link AudioFormat#ENCODING_DOLBY_TRUEHD}. */
|
||||
@UnstableApi public static final int ENCODING_DOLBY_TRUEHD = AudioFormat.ENCODING_DOLBY_TRUEHD;
|
||||
|
@ -48,6 +48,8 @@ import java.util.Arrays;
|
||||
@UnstableApi
|
||||
public final class AudioCapabilities {
|
||||
|
||||
// TODO(internal b/283945513): Have separate default max channel counts in `AudioCapabilities`
|
||||
// for PCM and compressed audio.
|
||||
private static final int DEFAULT_MAX_CHANNEL_COUNT = 10;
|
||||
@VisibleForTesting /* package */ static final int DEFAULT_SAMPLE_RATE_HZ = 48_000;
|
||||
|
||||
@ -374,9 +376,12 @@ public final class AudioCapabilities {
|
||||
|
||||
@DoNotInline
|
||||
public static ImmutableList<Integer> getDirectPlaybackSupportedEncodings() {
|
||||
ImmutableList<Integer> encodings = Api29.getAllSurroundEncodingsMaybeSupported();
|
||||
ImmutableList.Builder<Integer> supportedEncodingsListBuilder = ImmutableList.builder();
|
||||
for (int encoding : encodings) {
|
||||
for (int encoding : ALL_SURROUND_ENCODINGS_AND_MAX_CHANNELS.keySet()) {
|
||||
// AudioFormat.ENCODING_DTS_UHD_P2 is supported from API 34.
|
||||
if (Util.SDK_INT < 34 && encoding == C.ENCODING_DTS_UHD_P2) {
|
||||
continue;
|
||||
}
|
||||
if (AudioTrack.isDirectPlaybackSupported(
|
||||
new AudioFormat.Builder()
|
||||
.setChannelMask(AudioFormat.CHANNEL_OUT_STEREO)
|
||||
@ -413,19 +418,5 @@ public final class AudioCapabilities {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Returns a list of surround encodings that maybe supported. */
|
||||
@DoNotInline
|
||||
private static ImmutableList<Integer> getAllSurroundEncodingsMaybeSupported() {
|
||||
ImmutableList.Builder<Integer> encodings = new ImmutableList.Builder<>();
|
||||
for (int encoding : ALL_SURROUND_ENCODINGS_AND_MAX_CHANNELS.keySet()) {
|
||||
// AudioFormat.ENCODING_DTS_UHD_P2 is supported from API 34.
|
||||
if (Util.SDK_INT < 34 && encoding == C.ENCODING_DTS_UHD_P2) {
|
||||
continue;
|
||||
}
|
||||
encodings.add(encoding);
|
||||
}
|
||||
return encodings.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user