Merge pull request #728 from lawadr:audio-capabilities-fix

PiperOrigin-RevId: 574829263
This commit is contained in:
Copybara-Service 2023-10-19 05:18:21 -07:00
commit 5f80a47081
2 changed files with 8 additions and 1 deletions

View file

@ -22,6 +22,9 @@
* Audio: * Audio:
* Fix DTS Express audio buffer underflow issue * Fix DTS Express audio buffer underflow issue
([#650](https://github.com/androidx/media/pull/650)). ([#650](https://github.com/androidx/media/pull/650)).
* Fix bug where the capabilities check for E-AC3-JOC throws an
`IllegalArgumentException`
([#677](https://github.com/androidx/media/issues/677)).
* Video: * Video:
* Text: * Text:
* Remove `ExoplayerCuesDecoder`. Text tracks with `sampleMimeType = * Remove `ExoplayerCuesDecoder`. Text tracks with `sampleMimeType =

View file

@ -406,11 +406,15 @@ public final class AudioCapabilities {
// TODO(internal b/234351617): Query supported channel masks directly once it's supported, // TODO(internal b/234351617): Query supported channel masks directly once it's supported,
// see also b/25994457. // see also b/25994457.
for (int channelCount = DEFAULT_MAX_CHANNEL_COUNT; channelCount > 0; channelCount--) { for (int channelCount = DEFAULT_MAX_CHANNEL_COUNT; channelCount > 0; channelCount--) {
int channelConfig = Util.getAudioTrackChannelConfig(channelCount);
if (channelConfig == AudioFormat.CHANNEL_INVALID) {
continue;
}
AudioFormat audioFormat = AudioFormat audioFormat =
new AudioFormat.Builder() new AudioFormat.Builder()
.setEncoding(encoding) .setEncoding(encoding)
.setSampleRate(sampleRate) .setSampleRate(sampleRate)
.setChannelMask(Util.getAudioTrackChannelConfig(channelCount)) .setChannelMask(channelConfig)
.build(); .build();
if (AudioTrack.isDirectPlaybackSupported(audioFormat, DEFAULT_AUDIO_ATTRIBUTES)) { if (AudioTrack.isDirectPlaybackSupported(audioFormat, DEFAULT_AUDIO_ATTRIBUTES)) {
return channelCount; return channelCount;