{"record":{"id":"443e2f2db42e666e","repo":"DrKLO/Telegram","slug":"unhandled-format-inputaudioformat-443e2f","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/ResamplingAudioProcessor.java","lineNumber":50,"sourceCode":" *   <li>{@link C#ENCODING_PCM_24BIT}\n *   <li>{@link C#ENCODING_PCM_32BIT}\n *   <li>{@link C#ENCODING_PCM_FLOAT}\n * </ul>\n */\n/* package */ final class ResamplingAudioProcessor extends BaseAudioProcessor {\n\n  @Override\n  @CanIgnoreReturnValue\n  public AudioFormat onConfigure(AudioFormat inputAudioFormat)\n      throws UnhandledAudioFormatException {\n    @C.PcmEncoding int encoding = inputAudioFormat.encoding;\n    if (encoding != C.ENCODING_PCM_8BIT\n        && encoding != C.ENCODING_PCM_16BIT\n        && encoding != C.ENCODING_PCM_16BIT_BIG_ENDIAN\n        && encoding != C.ENCODING_PCM_24BIT\n        && encoding != C.ENCODING_PCM_32BIT\n        && encoding != C.ENCODING_PCM_FLOAT) {\n      throw new UnhandledAudioFormatException(inputAudioFormat);\n    }\n    return encoding != C.ENCODING_PCM_16BIT\n        ? new AudioFormat(\n            inputAudioFormat.sampleRate, inputAudioFormat.channelCount, C.ENCODING_PCM_16BIT)\n        : AudioFormat.NOT_SET;\n  }\n\n  @Override\n  public void queueInput(ByteBuffer inputBuffer) {\n    // Prepare the output buffer.\n    int position = inputBuffer.position();\n    int limit = inputBuffer.limit();\n    int size = limit - position;\n    int resampledSize;\n    switch (inputAudioFormat.encoding) {\n      case C.ENCODING_PCM_8BIT:\n        resampledSize = size * 2;\n        break;","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/src/main/java/com/google/android/exoplayer2/audio/ResamplingAudioProcessor.java#L32-L68","documentation":"ResamplingAudioProcessor.onConfigure throws UnhandledAudioFormatException when the input encoding is none of the supported PCM types: 8-bit, 16-bit, 16-bit big-endian, 24-bit, 32-bit, or float. This processor converts any supported PCM encoding to 16-bit PCM (the common denominator most Android AudioTracks accept); any non-PCM encoding (compressed like AAC/MP3, or an unknown encoding) is rejected because it cannot be resampled without decoding first.","triggerScenarios":"Passing a compressed encoding (e.g. ENCODING_AAC, ENCODING_MP3) or an unknown/unset encoding into the processor; a pipeline bug where the processor sits before the decoder; an encoding constant the processor's switch does not recognize (newer API encoding not in the list).","commonSituations":"Mis-ordered audio chain placing resampling before decoding; feeding AudioFormat.NOT_SET; using a custom encoding constant outside the supported PCM set; format negotiation producing an encoding the processor version doesn't know.","solutions":["Ensure the audio chain decodes compressed formats to PCM before any AudioProcessor; ResamplingAudioProcessor must sit after the decoder.","Guard the processor: only include it when inputAudioFormat.encoding is one of the known PCM constants.","Update ExoPlayer to a version whose processor list matches the encodings your sources use; otherwise map new encodings to a supported PCM encoding via a custom preprocessor."],"exampleFix":"// before: resampler in chain before decoder for a compressed source\nList<AudioProcessor> chain = List.of(resamplingProcessor); // ENCODING_AAC -> throw\n// after: ensure input is PCM before adding\n@C.Encoding int enc = inputAudioFormat.encoding;\nboolean isPcm = enc == C.ENCODING_PCM_8BIT || enc == C.ENCODING_PCM_16BIT\n  || enc == C.ENCODING_PCM_16BIT_BIG_ENDIAN || enc == C.ENCODING_PCM_24BIT\n  || enc == C.ENCODING_PCM_32BIT || enc == C.ENCODING_PCM_FLOAT;\nif (isPcm) chain.add(resamplingProcessor);","handlingStrategy":"validation","validationCode":"@C.Encoding int enc = inputAudioFormat.encoding;\nboolean isPcm = enc == C.ENCODING_PCM_8BIT || enc == C.ENCODING_PCM_16BIT\n  || enc == C.ENCODING_PCM_16BIT_BIG_ENDIAN || enc == C.ENCODING_PCM_24BIT\n  || enc == C.ENCODING_PCM_32BIT || enc == C.ENCODING_PCM_FLOAT;\nif (isPcm) chain.add(resamplingProcessor);","typeGuard":null,"tryCatchPattern":"try {\n  resamplingProcessor.onConfigure(inputAudioFormat);\n} catch (UnhandledAudioFormatException e) {\n  // not PCM; ensure a decoder precedes this processor in the chain\n}","preventionTips":["Place resampling after the decoder in the audio chain.","Guard insertion by checking the encoding is one of the known PCM constants.","Keep ExoPlayer updated so the processor recognizes your source encodings."],"tags":["exoplayer","audio","pcm","resampling","encoding","pipeline"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}