{"record":{"id":"8c82c70a3f31cdc0","repo":"DrKLO/Telegram","slug":"unable-to-configure-passthrough-for-inputformat","errorCode":null,"errorMessage":"Unable to configure passthrough for: {inputFormat}","messagePattern":"Unable to configure passthrough for: (.+?)","errorType":"exception","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"TMessagesProj/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java","lineNumber":761,"sourceCode":"      outputChannelConfig = Util.getAudioTrackChannelConfig(outputFormat.channelCount);\n      outputPcmFrameSize = Util.getPcmFrameSize(outputEncoding, outputFormat.channelCount);\n    } else {\n      inputPcmFrameSize = C.LENGTH_UNSET;\n      availableAudioProcessors = new AudioProcessor[0];\n      outputSampleRate = inputFormat.sampleRate;\n      outputPcmFrameSize = C.LENGTH_UNSET;\n      if (useOffloadedPlayback(inputFormat, audioAttributes)) {\n        outputMode = OUTPUT_MODE_OFFLOAD;\n        outputEncoding =\n            MimeTypes.getEncoding(checkNotNull(inputFormat.sampleMimeType), inputFormat.codecs);\n        outputChannelConfig = Util.getAudioTrackChannelConfig(inputFormat.channelCount);\n      } else {\n        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","sourceCodeStart":743,"sourceCodeEnd":779,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java#L743-L779","documentation":"DefaultAudioSink throws ConfigurationException('Unable to configure passthrough for: ...') when, in OUTPUT_MODE_PASSTHROUGH, audioCapabilities.getEncodingAndChannelConfigForPassthrough(inputFormat) returns null — i.e. the device's reported audio capabilities do not support passing the given format through to the platform AudioTrack untouched. Passthrough requires the device to natively decode/handle that encoding.","triggerScenarios":"Calling configure() (or starting playback) on a format marked for passthrough (e.g. AC3, E-AC3, DTS, TrueHD) on a device/TV whose AudioCapabilities report no matching encoding, or where the format's channel count exceeds what passthrough supports.","commonSituations":"Playing surround/AC3 content on a phone or emulator without the codec; HDMI/TV capability negotiation returning an empty set; a malformed Format with a sampleMimeType the device cannot pass through; running on an emulator that lacks passthrough support.","solutions":["Confirm the target device actually advertises the encoding via AudioManager/AudioCapabilities before requesting passthrough.","Fall back to decoded PCM playback (disable passthrough/offload) when capabilities do not include the required encoding.","Correct the Format's sampleMimeType/codecs/channelCount so they match a passthrough-capable encoding on the device."],"exampleFix":"// before\nsink = new DefaultAudioSink(...); // passthrough enabled by default for surround\n\n// after\nDefaultAudioSink sink = new DefaultAudioSink.Builder(context)\n    .setEnableAudioTrackPlayback(false) // force decode-to-PCM\n    .build();","handlingStrategy":"validation","validationCode":"// before enabling passthrough, check device capabilities\nAudioCapabilities caps = AudioCapabilities.getCapabilities(context);\nboolean passthroughOk =\n    caps.getEncodingAndChannelConfigForPassthrough(inputFormat) != null;\nif (!passthroughOk) { /* disable passthrough, decode to PCM */ }","typeGuard":null,"tryCatchPattern":"try { sink.configure(inputFormat, /* isOffload= */ false, /* audioAttrs= */ attrs); }\ncatch (AudioSink.ConfigurationException e) { /* retry with passthrough/offload disabled */ }","preventionTips":["Query AudioCapabilities for the target device before requesting passthrough.","Provide a PCM-decode fallback path on devices without the codec.","Test on a real TV/stb, not just emulators, since passthrough depends on the HAL."],"tags":["audio","exoplayer","passthrough","device-capabilities","configuration"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}