Skip to content

Commit 9c430c9

Browse files
author
Alexander Zuev
committed
8336920: ArithmeticException in javax.sound.sampled.AudioInputStream
Reviewed-by: azvegint, prr
1 parent bdf6e63 commit 9c430c9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: src/java.desktop/share/classes/com/sun/media/sound/SoftLinearResampler2.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -58,6 +58,10 @@ public void interpolate(float[] in, float[] in_offset, float in_end,
5858
int p_ix = (int) (ix * (1 << 15));
5959
int p_ix_end = (int) (ix_end * (1 << 15));
6060
int p_pitch = (int) (pitch * (1 << 15));
61+
if (p_pitch == 0) {
62+
// If pitch falls below the minimum assume minimum pitch
63+
p_pitch = 1;
64+
}
6165
// Pitch needs to recalculated
6266
// to ensure no drift between p_ix and ix.
6367
pitch = p_pitch * (1f / (1 << 15));

0 commit comments

Comments
 (0)