Commit f924fcb8 by samrobinson Committed by christosts

Generalise UnhandledAudioFormatException for non-input use cases.

PiperOrigin-RevId: 505084963
parent ee055ef0
...@@ -99,11 +99,15 @@ public interface AudioProcessor { ...@@ -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 { final class UnhandledAudioFormatException extends Exception {
public UnhandledAudioFormatException(AudioFormat inputAudioFormat) { public UnhandledAudioFormatException(AudioFormat inputAudioFormat) {
super("Unhandled format: " + inputAudioFormat); this("Unhandled input format:", inputAudioFormat);
}
public UnhandledAudioFormatException(String message, AudioFormat audioFormat) {
super(message + " " + audioFormat);
} }
} }
......
...@@ -74,7 +74,8 @@ import java.nio.ByteBuffer; ...@@ -74,7 +74,8 @@ import java.nio.ByteBuffer;
case C.ENCODING_PCM_FLOAT: case C.ENCODING_PCM_FLOAT:
return new FloatAudioMixingAlgorithm(mixingAudioFormat); return new FloatAudioMixingAlgorithm(mixingAudioFormat);
default: default:
throw new UnhandledAudioFormatException(mixingAudioFormat); throw new UnhandledAudioFormatException(
"No supported mixing algorithm available.", mixingAudioFormat);
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment