{"record":{"id":"b695fb68276fdb81","repo":"DrKLO/Telegram","slug":"unhandled-format-inputaudioformat-b695fb","errorCode":null,"errorMessage":"Unhandled format: {inputAudioFormat}","messagePattern":"Unhandled format: (.+?)","errorType":"exception","errorClass":"UnhandledAudioFormatException","httpStatus":null,"severity":"warning","filePath":"TMessagesProj/src/main/java/com/google/android/exoplayer2/audio/SilenceSkippingAudioProcessor.java","lineNumber":151,"sourceCode":"    this.enabled = enabled;\n  }\n\n  /**\n   * Returns the total number of frames of input audio that were skipped due to being classified as\n   * silence since the last call to {@link #flush()}.\n   */\n  public long getSkippedFrames() {\n    return skippedFrames;\n  }\n\n  // AudioProcessor implementation.\n\n  @Override\n  @CanIgnoreReturnValue\n  public AudioFormat onConfigure(AudioFormat inputAudioFormat)\n      throws UnhandledAudioFormatException {\n    if (inputAudioFormat.encoding != C.ENCODING_PCM_16BIT) {\n      throw new UnhandledAudioFormatException(inputAudioFormat);\n    }\n    return enabled ? inputAudioFormat : AudioFormat.NOT_SET;\n  }\n\n  @Override\n  public boolean isActive() {\n    return enabled;\n  }\n\n  @Override\n  public void queueInput(ByteBuffer inputBuffer) {\n    while (inputBuffer.hasRemaining() && !hasPendingOutput()) {\n      switch (state) {\n        case STATE_NOISY:\n          processNoisy(inputBuffer);\n          break;\n        case STATE_MAYBE_SILENT:\n          processMaybeSilence(inputBuffer);","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/src/main/java/com/google/android/exoplayer2/audio/SilenceSkippingAudioProcessor.java#L133-L169","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nsilenceSkippingProcessor.setEnabled(true); // always on\n// source is 24-bit PCM -> onConfigure throws\n// after\nif (inputAudioFormat.encoding == C.ENCODING_PCM_16BIT) {\n  silenceSkippingProcessor.setEnabled(true);\n} else {\n  silenceSkippingProcessor.setEnabled(false); // bypass, or resample to 16-bit first\n}","handlingStrategy":"validation","validationCode":"if (inputAudioFormat.encoding == C.ENCODING_PCM_16BIT) {\n  silenceSkippingProcessor.setEnabled(true);\n} else {\n  silenceSkippingProcessor.setEnabled(false);\n}","typeGuard":null,"tryCatchPattern":"try {\n  silenceSkippingProcessor.onConfigure(inputAudioFormat);\n} catch (UnhandledAudioFormatException e) {\n  silenceSkippingProcessor.setEnabled(false); // bypass for non-16-bit\n}","preventionTips":["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."],"tags":["exoplayer","audio","pcm","silence-skipping","encoding"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}