From 429bf4d099b5162ae304c0efd71f585e89939f2f Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Wed, 1 Aug 2018 01:04:23 -0700 Subject: [PATCH] Expand passthrough channel count workaround to all devices ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=206893078 --- .../android/exoplayer2/audio/DefaultAudioSink.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java b/library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java index ceb3080c9b..4c54297229 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java @@ -1129,11 +1129,14 @@ public final class DefaultAudioSink implements AudioSink { } private static int getChannelConfig(int channelCount, boolean isInputPcm) { - // Workaround for overly strict channel configuration checks on nVidia Shield. - if (Util.SDK_INT <= 23 && "foster".equals(Util.DEVICE) && "NVIDIA".equals(Util.MANUFACTURER)) { + if (Util.SDK_INT <= 28 && !isInputPcm) { + // In passthrough mode the channel count used to configure the audio track doesn't affect how + // the stream is handled, except that some devices do overly-strict channel configuration + // checks. Therefore we override the channel count so that a known-working channel + // configuration is chosen in all cases. See [Internal: b/29116190]. if (channelCount == 7) { channelCount = 8; - } else if (channelCount == 3 || channelCount == 5) { + } else if (channelCount == 3 || channelCount == 4 || channelCount == 5) { channelCount = 6; } }