{"record":{"id":"e5668074fb8016a8","repo":"DrKLO/Telegram","slug":"invalid-output-channel-config-mode-outputmode","errorCode":null,"errorMessage":"Invalid output channel config (mode={outputMode}) for: {inputFormat}","messagePattern":"Invalid output channel config \\(mode=(.+?)\\) for: (.+?)","errorType":"exception","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"TMessagesProj/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java","lineNumber":774,"sourceCode":"        outputMode = OUTPUT_MODE_PASSTHROUGH;\n        @Nullable\n        Pair<Integer, Integer> encodingAndChannelConfig =\n            audioCapabilities.getEncodingAndChannelConfigForPassthrough(inputFormat);\n        if (encodingAndChannelConfig == null) {\n          throw new ConfigurationException(\n              \"Unable to configure passthrough for: \" + inputFormat, inputFormat);\n        }\n        outputEncoding = encodingAndChannelConfig.first;\n        outputChannelConfig = encodingAndChannelConfig.second;\n      }\n    }\n\n    if (outputEncoding == C.ENCODING_INVALID) {\n      throw new ConfigurationException(\n          \"Invalid output encoding (mode=\" + outputMode + \") for: \" + inputFormat, inputFormat);\n    }\n    if (outputChannelConfig == AudioFormat.CHANNEL_INVALID) {\n      throw new ConfigurationException(\n          \"Invalid output channel config (mode=\" + outputMode + \") for: \" + inputFormat,\n          inputFormat);\n    }\n    int bufferSize =\n        specifiedBufferSize != 0\n            ? specifiedBufferSize\n            : audioTrackBufferSizeProvider.getBufferSizeInBytes(\n                getAudioTrackMinBufferSize(outputSampleRate, outputChannelConfig, outputEncoding),\n                outputEncoding,\n                outputMode,\n                outputPcmFrameSize != C.LENGTH_UNSET ? outputPcmFrameSize : 1,\n                outputSampleRate,\n                inputFormat.bitrate,\n                enableAudioTrackPlaybackParams ? MAX_PLAYBACK_SPEED : DEFAULT_PLAYBACK_SPEED);\n\n    offloadDisabledUntilNextConfiguration = false;\n    Configuration pendingConfiguration =\n        new Configuration(","sourceCodeStart":756,"sourceCodeEnd":792,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java#L756-L792","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set a valid, platform-supported channelCount on the Format (commonly 1, 2, or standard surround layouts).","Down-mix upstream to a supported channel count before reaching the sink.","Fall back to PCM decode if the channel layout cannot be passed through/offloaded."],"exampleFix":"// before\nformat = new Format.Builder().setChannelCount(channelCountFromManifest /* e.g. 0 */).build();\n\n// after\nformat = new Format.Builder().setChannelCount(Math.max(1, channelCountFromManifest)).build();","handlingStrategy":"validation","validationCode":"// verify channel config resolves before configuring\nint chCfg = Util.getAudioTrackChannelConfig(format.channelCount);\nif (chCfg == AudioFormat.CHANNEL_INVALID) { /* clamp/convert channel count */ }","typeGuard":null,"tryCatchPattern":"try { sink.configure(format, false, attrs); }\ncatch (AudioSink.ConfigurationException e) { /* retry with a supported channel count */ }","preventionTips":["Set a platform-supported channelCount on the Format.","Down-mix to stereo when the device cannot handle the original layout.","Validate channelCount is not 0/NO_VALUE before playback."],"tags":["audio","exoplayer","channel-config","passthrough","configuration","format-validation"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}