Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3ca8480 authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "AudioTrack: Do not throw exception from isMultichannelConfigSupported" into sc-v2-dev

parents 3ec70603 4b8954d4
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -1805,9 +1805,15 @@ public class AudioTrack extends PlayerBase
            return false;
            return false;
        }
        }
        final int channelCount = AudioFormat.channelCountFromOutChannelMask(channelConfig);
        final int channelCount = AudioFormat.channelCountFromOutChannelMask(channelConfig);
        final int channelCountLimit = AudioFormat.isEncodingLinearFrames(encoding)
        final int channelCountLimit;
        try {
            channelCountLimit = AudioFormat.isEncodingLinearFrames(encoding)
                    ? AudioSystem.OUT_CHANNEL_COUNT_MAX  // PCM limited to OUT_CHANNEL_COUNT_MAX
                    ? AudioSystem.OUT_CHANNEL_COUNT_MAX  // PCM limited to OUT_CHANNEL_COUNT_MAX
                    : AudioSystem.FCC_24;                // Compressed limited to 24 channels
                    : AudioSystem.FCC_24;                // Compressed limited to 24 channels
        } catch (IllegalArgumentException iae) {
            loge("Unsupported encoding " + iae);
            return false;
        }
        if (channelCount > channelCountLimit) {
        if (channelCount > channelCountLimit) {
            loge("Channel configuration contains too many channels for encoding "
            loge("Channel configuration contains too many channels for encoding "
                    + encoding + "(" + channelCount + " > " + channelCountLimit + ")");
                    + encoding + "(" + channelCount + " > " + channelCountLimit + ")");