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

Commit d954e908 authored by Jiabin Huang's avatar Jiabin Huang Committed by Automerger Merge Worker
Browse files

Merge "Support 8 channel IEC61937." into sc-dev am: 6c989259

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14202264

Change-Id: I193fc0cd28e18c93a5413343bcb579cc27ee66ab
parents b607aed3 6c989259
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -273,8 +273,8 @@ public final class AudioFormat implements Parcelable {

    /** Audio data format: compressed audio wrapped in PCM for HDMI
     * or S/PDIF passthrough.
     * IEC61937 uses a stereo stream of 16-bit samples as the wrapper.
     * So the channel mask for the track must be {@link #CHANNEL_OUT_STEREO}.
     * For devices whose SDK version is less than {@link android.os.Build.VERSION_CODES#S}, the
     * channel mask of IEC61937 track must be {@link #CHANNEL_OUT_STEREO}.
     * Data should be written to the stream in a short[] array.
     * If the data is written in a byte[] array then there may be endian problems
     * on some platforms when converting to short internally.
+4 −6
Original line number Diff line number Diff line
@@ -1676,13 +1676,11 @@ public class AudioTrack extends PlayerBase
        }
        mSampleRate = sampleRateInHz;

        // IEC61937 is based on stereo. We could coerce it to stereo.
        // But the application needs to know the stream is stereo so that
        // it is encoded and played correctly. So better to just reject it.
        if (audioFormat == AudioFormat.ENCODING_IEC61937
                && channelConfig != AudioFormat.CHANNEL_OUT_STEREO) {
            throw new IllegalArgumentException(
                    "ENCODING_IEC61937 must be configured as CHANNEL_OUT_STEREO");
                && channelConfig != AudioFormat.CHANNEL_OUT_STEREO
                && AudioFormat.channelCountFromOutChannelMask(channelConfig) != 8) {
            Log.w(TAG, "ENCODING_IEC61937 is configured with channel mask as " + channelConfig
                    + ", which is not 2 or 8 channels");
        }

        //--------------