DrKLO/Telegram · warning · UnhandledAudioFormatException
Unhandled format: {inputAudioFormat}
Error message
Unhandled format: {inputAudioFormat} What it means
FloatResamplingAudioProcessor.onConfigure throws UnhandledAudioFormatException when the input encoding is not 'high resolution PCM' (Util.isEncodingHighResolutionPcm returns false). This processor specifically converts higher-than-16-bit integer PCM (24-bit, 32-bit int) to 32-bit float; it does not handle 8-bit, 16-bit, float, or compressed encodings. 16-bit and float inputs are not 'high resolution' and are rejected so the pipeline can route them elsewhere (16-bit needs no resampling; float is already float).
Source
Thrown at TMessagesProj/src/main/java/com/google/android/exoplayer2/audio/FloatResamplingAudioProcessor.java:45
*
* <ul>
* <li>{@link C#ENCODING_PCM_24BIT}
* <li>{@link C#ENCODING_PCM_32BIT}
* <li>{@link C#ENCODING_PCM_FLOAT} ({@link #isActive()} will return {@code false})
* </ul>
*/
/* package */ final class FloatResamplingAudioProcessor extends BaseAudioProcessor {
private static final int FLOAT_NAN_AS_INT = Float.floatToIntBits(Float.NaN);
private static final double PCM_32_BIT_INT_TO_PCM_32_BIT_FLOAT_FACTOR = 1.0 / 0x7FFFFFFF;
@Override
@CanIgnoreReturnValue
public AudioFormat onConfigure(AudioFormat inputAudioFormat)
throws UnhandledAudioFormatException {
@C.PcmEncoding int encoding = inputAudioFormat.encoding;
if (!Util.isEncodingHighResolutionPcm(encoding)) {
throw new UnhandledAudioFormatException(inputAudioFormat);
}
return encoding != C.ENCODING_PCM_FLOAT
? new AudioFormat(
inputAudioFormat.sampleRate, inputAudioFormat.channelCount, C.ENCODING_PCM_FLOAT)
: AudioFormat.NOT_SET;
}
@Override
public void queueInput(ByteBuffer inputBuffer) {
int position = inputBuffer.position();
int limit = inputBuffer.limit();
int size = limit - position;
ByteBuffer buffer;
switch (inputAudioFormat.encoding) {
case C.ENCODING_PCM_24BIT:
buffer = replaceOutputBuffer((size / 3) * 4);
for (int i = position; i < limit; i += 3) {View on GitHub (pinned to 45ab8f4308)
Solutions
- Only insert FloatResamplingAudioProcessor in the chain when the source encoding is ENCODING_PCM_24BIT or ENCODING_PCM_32BIT (high-resolution integer PCM).
- For sources that may be mixed, guard insertion: if inputAudioFormat is hi-res PCM include it, otherwise omit it.
- Configure the audio sink (DefaultAudioSink) to negotiate the right chain; the sink will skip processors whose onConfigure throws UnhandledAudioFormatException if they report NOT_SET appropriately — ensure the processor is only active for hi-res.
Example fix
// before: always added
List<AudioProcessor> chain = List.of(floatResamplingProcessor); // throws on 16-bit input
// after: conditionally include
List<AudioProcessor> chain = new ArrayList<>();
if (Util.isEncodingHighResolutionPcm(inputAudioFormat.encoding)
&& inputAudioFormat.encoding != C.ENCODING_PCM_FLOAT) {
chain.add(floatResamplingProcessor);
} Defensive patterns
Strategy: validation
Validate before calling
@C.Encoding int enc = inputAudioFormat.encoding;
boolean needsFloatResample = Util.isEncodingHighResolutionPcm(enc)
&& enc != C.ENCODING_PCM_FLOAT;
// only add FloatResamplingAudioProcessor when needsFloatResample is true Prevention
- Only insert FloatResamplingAudioProcessor for 24/32-bit integer PCM sources.
- Let the AudioSink negotiate the processor chain based on the active format.
- Disable float resampling when source is 16-bit or already float.
When it happens
Trigger: Feeding 16-bit PCM, 8-bit PCM, or already-float PCM into FloatResamplingAudioProcessor; a pipeline that always inserts this processor regardless of source encoding; a format change mid-playback dropping below the hi-res threshold.
Common situations: Default audio chain that includes float resampling but plays a standard 16-bit track; toggling output to float on a stereo 16-bit source; source switch from 24-bit FLAC to 16-bit MP3 without disabling the resampler.
Related errors
- Unhandled format: {inputAudioFormat}
- Unhandled format: {inputAudioFormat}
- Unhandled format: {inputAudioFormat}
- Unhandled format: {inputAudioFormat}
- Invalid output encoding (mode={outputMode}) for: {inputForma
AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14).
Data as JSON: /api/errors/b618431737e180ba.
Report an issue: GitHub.