DrKLO/Telegram · error · ConfigurationException

Invalid output channel config (mode={outputMode}) for: {inpu

Error message

Invalid output channel config (mode={outputMode}) for: {inputFormat}

What it means

DefaultAudioSink throws ConfigurationException('Invalid output channel config (mode=...) for: ...') when the resolved outputChannelConfig equals AudioFormat.CHANNEL_INVALID after passthrough/offload configuration. This means the input channel count could not be mapped to a valid platform AudioTrack channel mask, so playback cannot proceed.

Source

Thrown at TMessagesProj/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java:774

        outputMode = OUTPUT_MODE_PASSTHROUGH;
        @Nullable
        Pair<Integer, Integer> encodingAndChannelConfig =
            audioCapabilities.getEncodingAndChannelConfigForPassthrough(inputFormat);
        if (encodingAndChannelConfig == null) {
          throw new ConfigurationException(
              "Unable to configure passthrough for: " + inputFormat, inputFormat);
        }
        outputEncoding = encodingAndChannelConfig.first;
        outputChannelConfig = encodingAndChannelConfig.second;
      }
    }

    if (outputEncoding == C.ENCODING_INVALID) {
      throw new ConfigurationException(
          "Invalid output encoding (mode=" + outputMode + ") for: " + inputFormat, inputFormat);
    }
    if (outputChannelConfig == AudioFormat.CHANNEL_INVALID) {
      throw new ConfigurationException(
          "Invalid output channel config (mode=" + outputMode + ") for: " + inputFormat,
          inputFormat);
    }
    int bufferSize =
        specifiedBufferSize != 0
            ? specifiedBufferSize
            : audioTrackBufferSizeProvider.getBufferSizeInBytes(
                getAudioTrackMinBufferSize(outputSampleRate, outputChannelConfig, outputEncoding),
                outputEncoding,
                outputMode,
                outputPcmFrameSize != C.LENGTH_UNSET ? outputPcmFrameSize : 1,
                outputSampleRate,
                inputFormat.bitrate,
                enableAudioTrackPlaybackParams ? MAX_PLAYBACK_SPEED : DEFAULT_PLAYBACK_SPEED);

    offloadDisabledUntilNextConfiguration = false;
    Configuration pendingConfiguration =
        new Configuration(

View on GitHub (pinned to 45ab8f4308)

Solutions

  1. Set a valid, platform-supported channelCount on the Format (commonly 1, 2, or standard surround layouts).
  2. Down-mix upstream to a supported channel count before reaching the sink.
  3. Fall back to PCM decode if the channel layout cannot be passed through/offloaded.

Example fix

// before
format = new Format.Builder().setChannelCount(channelCountFromManifest /* e.g. 0 */).build();

// after
format = new Format.Builder().setChannelCount(Math.max(1, channelCountFromManifest)).build();
Defensive patterns

Strategy: validation

Validate before calling

// verify channel config resolves before configuring
int chCfg = Util.getAudioTrackChannelConfig(format.channelCount);
if (chCfg == AudioFormat.CHANNEL_INVALID) { /* clamp/convert channel count */ }

Try / catch

try { sink.configure(format, false, attrs); }
catch (AudioSink.ConfigurationException e) { /* retry with a supported channel count */ }

Prevention

When it happens

Trigger: Offload path: Util.getAudioTrackChannelConfig(inputFormat.channelCount) returns CHANNEL_INVALID (e.g. an unsupported/odd channel count). Passthrough path: capability pair whose second element is CHANNEL_INVALID.

Common situations: Format declares a channelCount the platform does not map to a known channel configuration (e.g. >8 channels, or an unusual layout); corrupted manifest declaring channelCount=0 or NO_VALUE.

Related errors


AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14). Data as JSON: /api/errors/e5668074fb8016a8. Report an issue: GitHub.