{"record":{"id":"889fb34355336b41","repo":"google/ExoPlayer","slug":"unhandled-input-format-inputaudioformat","errorCode":null,"errorMessage":"Unhandled input format: {inputAudioFormat}","messagePattern":"Unhandled input format: (.+?)","errorType":"exception","errorClass":"AudioProcessor.UnhandledAudioFormatException","httpStatus":null,"severity":"error","filePath":"library/core/src/main/java/com/google/android/exoplayer2/audio/SilenceSkippingAudioProcessor.java","lineNumber":157,"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":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/google/ExoPlayer/blob/dd430f7053a1a3958deea3ead6a0565150c06bfc/library/core/src/main/java/com/google/android/exoplayer2/audio/SilenceSkippingAudioProcessor.java#L139-L175","documentation":"SilenceSkippingAudioProcessor strips long silences from PCM audio (used for features like automatic silence skipping and speed ramping, e.g. in IMA/Sonic-based paths). During configuration it only accepts ENCODING_PCM_16BIT input; any other encoding causes UnhandledAudioFormatException so the audio chain can be rebuilt without this processor rather than corrupt the audio.","triggerScenarios":"Enabling silence skipping (e.g. via DefaultAudioSink.Builder.setSilenceSkippingEnabled or experimental speed-changing pipelines) while the decoded audio is 24/32-bit PCM or float rather than 16-bit.","commonSituations":"Devices decoders outputting ENCODING_PCM_FLOAT; apps enabling audio processors while playing high-resolution PCM; version upgrades where float output became the default; combining silence skipping with offload (offload bypasses the PCM chain anyway).","solutions":["Disable silence skipping for high-res/float content.","Force 16-bit PCM output by disabling float output on the decoder side (do not request ENCODING_PCM_FLOAT; on API 21-22 avoid float output flags).","Catch the exception at configuration and rebuild the sink without silence skipping before retrying playback.","Check the incoming Format encoding before enabling processors and skip processors for non-16-bit media."],"exampleFix":"// before\nnew DefaultAudioSink.Builder(ctx)\n    .setSilenceSkippingEnabled(true) // all content\n    .build();\n\n// after — only for 16-bit-capable content\nnew DefaultAudioSink.Builder(ctx)\n    .setSilenceSkippingEnabled(isPcm16Content)\n    .build();","handlingStrategy":"validation","validationCode":"boolean silenceSkipSafe =\n    decodedFormat.sampleMimeType.equals(MimeTypes.AUDIO_RAW)\n        && decodedFormat.pcmEncoding == C.ENCODING_PCM_16BIT;\nsinkBuilder.setSilenceSkippingEnabled(silenceSkipSafe);","typeGuard":null,"tryCatchPattern":"try {\n  configureSink(silenceSkipping = true);\n} catch (AudioProcessor.UnhandledAudioFormatException e) {\n  configureSink(silenceSkipping = false); // rebuild chain without the processor\n}","preventionTips":["Enable silence skipping only for confirmed 16-bit PCM pipelines","Watch Format.pcmEncoding on track changes and reconfigure the sink","Do not combine silence skipping with float/high-res output requests"],"tags":["exoplayer","audio","pcm","silence-skipping","configuration"],"backgroundTag":null,"analyzedSha":"dd430f7053a1a3958deea3ead6a0565150c06bfc","analyzedAt":"2026-08-14T12:22:02.982Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}