DrKLO/Telegram · warning · UnhandledAudioFormatException
Unhandled format: {inputAudioFormat}
Error message
Unhandled format: {inputAudioFormat} What it means
SilenceSkippingAudioProcessor.onConfigure throws UnhandledAudioFormatException when the input encoding is not C.ENCODING_PCM_16BIT. This processor detects and removes silence runs using 16-bit amplitude heuristics; it only operates on 16-bit PCM. Other encodings (8/24/32-bit, float, compressed) lack the amplitude semantics the algorithm assumes and are rejected so the pipeline can bypass the processor or convert the input first.
Source
Thrown at TMessagesProj/src/main/java/com/google/android/exoplayer2/audio/SilenceSkippingAudioProcessor.java:151
this.enabled = enabled;
}
/**
* Returns the total number of frames of input audio that were skipped due to being classified as
* silence since the last call to {@link #flush()}.
*/
public long getSkippedFrames() {
return skippedFrames;
}
// AudioProcessor implementation.
@Override
@CanIgnoreReturnValue
public AudioFormat onConfigure(AudioFormat inputAudioFormat)
throws UnhandledAudioFormatException {
if (inputAudioFormat.encoding != C.ENCODING_PCM_16BIT) {
throw new UnhandledAudioFormatException(inputAudioFormat);
}
return enabled ? inputAudioFormat : AudioFormat.NOT_SET;
}
@Override
public boolean isActive() {
return enabled;
}
@Override
public void queueInput(ByteBuffer inputBuffer) {
while (inputBuffer.hasRemaining() && !hasPendingOutput()) {
switch (state) {
case STATE_NOISY:
processNoisy(inputBuffer);
break;
case STATE_MAYBE_SILENT:
processMaybeSilence(inputBuffer);View on GitHub (pinned to 45ab8f4308)
Solutions
- Disable silence skipping (setEnabled(false), leave pending null) when the source encoding is not 16-bit PCM; insert a ResamplingAudioProcessor upstream to down-convert to 16-bit first.
- Gate enabling on the current AudioFormat: only setEnabled(true) when inputAudioFormat.encoding == C.ENCODING_PCM_16BIT.
- If silence removal is needed for hi-res sources, run it after a down-conversion step rather than on the native hi-res stream.
Example fix
// before
silenceSkippingProcessor.setEnabled(true); // always on
// source is 24-bit PCM -> onConfigure throws
// after
if (inputAudioFormat.encoding == C.ENCODING_PCM_16BIT) {
silenceSkippingProcessor.setEnabled(true);
} else {
silenceSkippingProcessor.setEnabled(false); // bypass, or resample to 16-bit first
} Defensive patterns
Strategy: validation
Validate before calling
if (inputAudioFormat.encoding == C.ENCODING_PCM_16BIT) {
silenceSkippingProcessor.setEnabled(true);
} else {
silenceSkippingProcessor.setEnabled(false);
} Try / catch
try {
silenceSkippingProcessor.onConfigure(inputAudioFormat);
} catch (UnhandledAudioFormatException e) {
silenceSkippingProcessor.setEnabled(false); // bypass for non-16-bit
} Prevention
- Only enable silence skipping for 16-bit PCM sources.
- Down-convert hi-res sources to 16-bit before the silence processor.
- Re-check the encoding whenever the source format changes.
When it happens
Trigger: Enabling silence skipping (setEnabled(true) / set it pending) while the source is non-16-bit PCM — e.g. hi-res 24-bit FLAC, float PCM from a float decoder, or compressed audio routed incorrectly; a format switch mid-stream to a non-16-bit encoding with silence skipping left on.
Common situations: Default audio chain enabling silence skipping for all sources; playing hi-res audio where the decoder outputs 24/32-bit or float; toggling silence skipping at runtime without checking the current encoding.
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/b695fb68276fdb81.
Report an issue: GitHub.