mirror of
https://github.com/samsonjs/media.git
synced 2026-03-30 10:15:48 +00:00
Generalise UnhandledAudioFormatException for non-input use cases.
PiperOrigin-RevId: 505084963
This commit is contained in:
parent
5c82d6bc18
commit
5e44af0ad9
2 changed files with 8 additions and 3 deletions
|
|
@ -101,11 +101,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue