google/ExoPlayer · error · AudioProcessor.UnhandledAudioFormatException
Unhandled input format: {inputAudioFormat}
Error message
Unhandled input format: {inputAudioFormat} What it means
Deprecated ToFloatPcmAudioProcessor converted high-resolution integer PCM (24/32-bit) to 32-bit float PCM for output devices that accept float. onConfigure throws UnhandledAudioFormatException unless Util.isEncodingHighResolutionPcm(encoding) — i.e. the input must be ENCODING_PCM_24BIT, ENCODING_PCM_32BIT, or ENCODING_PCM_FLOAT; 16-bit or compressed input is rejected because the conversion would be meaningless.
Source
Thrown at library/core/src/main/java/com/google/android/exoplayer2/audio/ToFloatPcmAudioProcessor.java:51
*
* @deprecated com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which
* contains the same ExoPlayer code). See <a
* href="https://developer.android.com/guide/topics/media/media3/getting-started/migration-guide">the
* migration guide</a> for more details, including a script to help with the migration.
*/
@Deprecated
/* package */ final class ToFloatPcmAudioProcessor 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 dd430f7053)
Solutions
- Upgrade to a modern ExoPlayer/Media3 release where ToFloatPcmAudioProcessor is no longer used and float handling is internal.
- Do not manually inject ToFloatPcmAudioProcessor into the audio processor chain.
- Only request float output when the source decodes to 24/32-bit PCM.
- If pinned to an old version, disable float output (default PCM 16-bit) in the sink configuration.
Example fix
// before (deprecated path)
sinkBuilder.setAudioProcessors(
new AudioProcessor[] {new ToFloatPcmAudioProcessor()});
// after — let the sink handle conversion; supply no custom processors
// DefaultAudioSink chooses float automatically for high-res PCM
sinkBuilder.setAudioProcessors(new AudioProcessor[0]); Defensive patterns
Strategy: validation
Validate before calling
static boolean supportsFloatConversion(@C.PcmEncoding int enc) {
return Util.isEncodingHighResolutionPcm(enc);
}
// only enable float output paths when supportsFloatConversion(currentPcmEncoding) Try / catch
try {
sink.configure(floatOutputOn);
} catch (AudioProcessor.UnhandledAudioFormatException e) {
sink.configure(floatOutputOff); // fall back to 16-bit chain
} Prevention
- Upgrade to Media3 — the deprecated processor is gone
- Never inject deprecated ToFloatPcmAudioProcessor manually
- Request float output only for 24/32-bit sources
When it happens
Trigger: The sink enabling this processor while the decoded chain delivers 16-bit PCM — historically when float output was requested on devices/API levels where the decoder emitted 16-bit, or with custom audio processors chained in the wrong order.
Common situations: Legacy apps on old ExoPlayer versions requesting float output for 16-bit sources; custom DefaultAudioSink configurations forcing the deprecated float path; class is deprecated precisely because float conversion is now handled internally — presence of this error signals outdated integration code.
Related errors
- Unhandled input format:
- Unhandled input format: {inputAudioFormat}
- Unhandled input format: {inputAudioFormat}
- Unhandled input format: ${audioFormat}
- Unhandled input format: {audioFormat}
AI-assisted analysis of google/ExoPlayer@dd430f7053 (2026-08-14).
Data as JSON: /api/errors/c07962555be001d0.
Report an issue: GitHub.