Generalise UnhandledAudioFormatException for non-input use cases.

PiperOrigin-RevId: 505084963
This commit is contained in:
samrobinson 2023-01-27 12:32:58 +00:00 committed by christosts
parent ee055ef004
commit f924fcb8b4
2 changed files with 8 additions and 3 deletions

View File

@ -99,11 +99,15 @@ public interface AudioProcessor {
}
}
/** Exception thrown when a processor can't be configured for a given input audio format. */
/** Exception thrown when the given {@link AudioFormat} can not be handled. */
final class UnhandledAudioFormatException extends Exception {
public UnhandledAudioFormatException(AudioFormat inputAudioFormat) {
super("Unhandled format: " + inputAudioFormat);
this("Unhandled input format:", inputAudioFormat);
}
public UnhandledAudioFormatException(String message, AudioFormat audioFormat) {
super(message + " " + audioFormat);
}
}

View File

@ -74,7 +74,8 @@ import java.nio.ByteBuffer;
case C.ENCODING_PCM_FLOAT:
return new FloatAudioMixingAlgorithm(mixingAudioFormat);
default:
throw new UnhandledAudioFormatException(mixingAudioFormat);
throw new UnhandledAudioFormatException(
"No supported mixing algorithm available.", mixingAudioFormat);
}
}
}