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

Commit 8146fbf6 authored by Mikhail Naganov's avatar Mikhail Naganov Committed by Android (Google) Code Review
Browse files

Merge "AudioMix: Always produce output channel masks from Builder"

parents e94749c4 e1fa0d0f
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -420,6 +420,20 @@ public class AudioMix {
                    rate = 44100;
                }
                mFormat = new AudioFormat.Builder().setSampleRate(rate).build();
            } else {
                // Ensure that 'mFormat' uses an output channel mask. Using an input channel
                // mask was not made 'illegal' initially, however the framework code
                // assumes usage in AudioMixes of output channel masks only (b/194910301).
                if ((mFormat.getPropertySetMask()
                                & AudioFormat.AUDIO_FORMAT_HAS_PROPERTY_CHANNEL_MASK) != 0) {
                    if (mFormat.getChannelCount() == 1
                            && mFormat.getChannelMask() == AudioFormat.CHANNEL_IN_MONO) {
                        mFormat = new AudioFormat.Builder(mFormat).setChannelMask(
                                AudioFormat.CHANNEL_OUT_MONO).build();
                    }
                    // CHANNEL_IN_STEREO == CHANNEL_OUT_STEREO so no need to correct.
                    // CHANNEL_IN_FRONT_BACK is hidden, should not appear.
                }
            }
            if ((mDeviceSystemType != AudioSystem.DEVICE_NONE)
                    && (mDeviceSystemType != AudioSystem.DEVICE_OUT_REMOTE_SUBMIX)