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

PiperOrigin-RevId: 574829263
(cherry picked from commit 5f80a4708165ffe977ce37400f7c8eae01142e2d)
This commit is contained in:
Copybara-Service 2023-10-19 05:18:21 -07:00 committed by Rohit Singh
parent a8b0bd712a
commit cb67b16cac
2 changed files with 8 additions and 1 deletions

View File

@ -15,6 +15,9 @@
* Audio:
* Fix DTS Express audio buffer underflow issue
([#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:
* Text:
* 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,
// see also b/25994457.
for (int channelCount = DEFAULT_MAX_CHANNEL_COUNT; channelCount > 0; channelCount--) {
int channelConfig = Util.getAudioTrackChannelConfig(channelCount);
if (channelConfig == AudioFormat.CHANNEL_INVALID) {
continue;
}
AudioFormat audioFormat =
new AudioFormat.Builder()
.setEncoding(encoding)
.setSampleRate(sampleRate)
.setChannelMask(Util.getAudioTrackChannelConfig(channelCount))
.setChannelMask(channelConfig)
.build();
if (AudioTrack.isDirectPlaybackSupported(audioFormat, DEFAULT_AUDIO_ATTRIBUTES)) {
return channelCount;