{"record":{"id":"2473b33bbe10aea9","repo":"google/ExoPlayer","slug":"unable-to-configure-passthrough-for-s","errorCode":null,"errorMessage":"Unable to configure passthrough for: %s","messagePattern":"Unable to configure passthrough for: (.+?)","errorType":"exception","errorClass":"AudioSink.ConfigurationException","httpStatus":null,"severity":"error","filePath":"library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java","lineNumber":715,"sourceCode":"      // Audio processing is not supported in offload or passthrough mode.\n      audioProcessingPipeline = new AudioProcessingPipeline(ImmutableList.of());\n      inputPcmFrameSize = C.LENGTH_UNSET;\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        // Offload requires AudioTrack playback parameters to apply speed changes quickly.\n        enableAudioTrackPlaybackParams = true;\n      } else {\n        outputMode = OUTPUT_MODE_PASSTHROUGH;\n        @Nullable\n        Pair<Integer, Integer> encodingAndChannelConfig =\n            getAudioCapabilities().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        // Passthrough only supports AudioTrack playback parameters, but we only enable it this was\n        // specifically requested by the app.\n        enableAudioTrackPlaybackParams = preferAudioTrackPlaybackParams;\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);","sourceCodeStart":697,"sourceCodeEnd":733,"githubUrl":"https://github.com/google/ExoPlayer/blob/dd430f7053a1a3958deea3ead6a0565150c06bfc/library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java#L697-L733","documentation":"When DefaultAudioSink is configured to pass the compressed bitstream straight to the output device (OUTPUT_MODE_PASSTHROUGH), it asks the device's AudioCapabilities for a (encoding, channelConfig) pair the output can actually decode. If getEncodingAndChannelConfigForPassthrough returns null — the device/TV/receiver does not advertise support for that encoding/channel combination — a ConfigurationException('Unable to configure passthrough for: <format>') is thrown from AudioSink.configure.","triggerScenarios":"Playing AC-3/E-AC-3/DTS/TrueHD etc. with passthrough enabled (DefaultAudioSink offload or the MediaCodec selector choosing a passthrough decoder) on a device whose AudioManager reports no matching surrogate encoding/channel layout — e.g. sending 6-channel E-AC-3 to a TV that only accepts 2-channel AAC.","commonSituations":"Android TV apps assuming receivers support AC-3; HDMI chain (dongle → AVR → TV) where the reported capabilities reflect the final sink; USB/headphone output advertising no compressed encodings; emulator images with no passthrough capability; channel-count mismatch between stream and device-reported max.","solutions":["Play in PCM decode mode instead: don't force passthrough — let DefaultTrackSelector choose decodable tracks (disable the passthrough flag / Map<String, String> override).","Advertise capabilities explicitly if the environment is known: DefaultAudioSink.Builder.setAudioCapabilities(AudioCapabilities.EXTERNAL_SURROUND) or construct from AudioManager settings.","Include a PCM fallback variant in your HLS/DASH manifest and let ExoPlayer's track selection fall back when passthrough fails (set enabled decoders via RenderersFactory with enableDecoderFallback).","Catch ConfigurationException around playback initiation and retry after disabling passthrough for that item."],"exampleFix":"// before — force passthrough for everything\ntrackSelector.setParameters(\n    new DefaultTrackSelector.Parameters.Builder(ctx)\n        .setOverrideDisableAudioRenderersIfDecoderInitFails(false)\n        .build()); // + custom selector preferring passthrough\n\n// after — allow decode fallback when the sink cannot passthrough\ntrackSelector.setParameters(\n    new DefaultTrackSelector.Parameters.Builder(ctx)\n        .setExceedAudioConstraintsIfNecessary(true)\n        .build());\n// DefaultRenderersFactory\nnew DefaultRenderersFactory(ctx).setEnableDecoderFallback(true);","handlingStrategy":"fallback","validationCode":"AudioCapabilities caps = DefaultAudioSink.getAudioCapabilities(context);\n// null here => device cannot passthrough this format\nif (caps.getEncodingAndChannelConfigForPassthrough(format) == null) {\n  selectPcmPlayback();\n}","typeGuard":null,"tryCatchPattern":"try {\n  player.setMediaItem(passthroughItem);\n  player.prepare();\n} catch (PlaybackException e) {\n  if (e.getErrorCode()\n      == PlaybackException.ERROR_CODE_AUDIO_TRACK_INIT_FAILED) {\n    switchToPcmAndRetry(passthroughItem);\n  }\n}","preventionTips":["Query AudioCapabilities before preferring passthrough tracks","Include PCM renditions in manifests as fallback","Enable decoder fallback on DefaultRenderersFactory","Test on real TV/receiver chains, not just emulators"],"tags":["exoplayer","audio","passthrough","configuration","capabilities","android-tv"],"backgroundTag":null,"analyzedSha":"dd430f7053a1a3958deea3ead6a0565150c06bfc","analyzedAt":"2026-08-14T12:22:02.982Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}