-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
8u72
-
x86_64
-
linux_ubuntu
FULL PRODUCT VERSION :
owner@owner-VirtualBox:~/Desktop$ java -version
openjdk version "1.8.0_66-internal"
OpenJDK Runtime Environment (build 1.8.0_66-internal-b17)
OpenJDK 64-Bit Server VM (build 25.66-b17, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
owner@owner-VirtualBox:~/Desktop$ uname -a
Linux owner-VirtualBox 4.2.0-16-generic #19-Ubuntu SMP Thu Oct 8 15:35:06 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
The pulse audio implementation in OpenJDK does not like calling stop and other methods before an audio Clip is played at least once. This does not occur under the OracleJDK.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
owner@owner-VirtualBox:~/Desktop$ java -jar PulseAudioStop.jar
Exception in thread "main" java.lang.IllegalStateException: Line not open
at org.classpath.icedtea.pulseaudio.PulseAudioClip.stop(PulseAudioClip.java:543)
at test.PulseAudioStop.main(PulseAudioStop.java:30)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;
import javax.swing.SwingUtilities;
public class PulseAudioStop {
public static void main(String[] args) throws FileNotFoundException,
UnsupportedAudioFileException, IOException, LineUnavailableException {
AudioInputStream ais = AudioSystem.getAudioInputStream(new File("sound.wav"));
AudioFormat fmt = ais.getFormat();
// Forcibly convert to PCM Signed because non-pulse can't play unsigned (Java bug)
if (fmt.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) {
fmt = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, fmt.getSampleRate(),
fmt.getSampleSizeInBits() * 2, fmt.getChannels(), fmt.getFrameSize() * 2,
fmt.getFrameRate(), true);
ais = AudioSystem.getAudioInputStream(fmt, ais);
}
final Clip clip = (Clip) AudioSystem.getLine(new DataLine.Info(Clip.class, fmt));
clip.stop(); // does not error on Oracle JDK but crashes in OpenJDk Pulse audio impl.
clip.open(ais);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
clip.start();
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
The current work around is to check isOpen() before calling stop.
SUPPORT :
YES
owner@owner-VirtualBox:~/Desktop$ java -version
openjdk version "1.8.0_66-internal"
OpenJDK Runtime Environment (build 1.8.0_66-internal-b17)
OpenJDK 64-Bit Server VM (build 25.66-b17, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
owner@owner-VirtualBox:~/Desktop$ uname -a
Linux owner-VirtualBox 4.2.0-16-generic #19-Ubuntu SMP Thu Oct 8 15:35:06 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
The pulse audio implementation in OpenJDK does not like calling stop and other methods before an audio Clip is played at least once. This does not occur under the OracleJDK.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
owner@owner-VirtualBox:~/Desktop$ java -jar PulseAudioStop.jar
Exception in thread "main" java.lang.IllegalStateException: Line not open
at org.classpath.icedtea.pulseaudio.PulseAudioClip.stop(PulseAudioClip.java:543)
at test.PulseAudioStop.main(PulseAudioStop.java:30)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;
import javax.swing.SwingUtilities;
public class PulseAudioStop {
public static void main(String[] args) throws FileNotFoundException,
UnsupportedAudioFileException, IOException, LineUnavailableException {
AudioInputStream ais = AudioSystem.getAudioInputStream(new File("sound.wav"));
AudioFormat fmt = ais.getFormat();
// Forcibly convert to PCM Signed because non-pulse can't play unsigned (Java bug)
if (fmt.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) {
fmt = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, fmt.getSampleRate(),
fmt.getSampleSizeInBits() * 2, fmt.getChannels(), fmt.getFrameSize() * 2,
fmt.getFrameRate(), true);
ais = AudioSystem.getAudioInputStream(fmt, ais);
}
final Clip clip = (Clip) AudioSystem.getLine(new DataLine.Info(Clip.class, fmt));
clip.stop(); // does not error on Oracle JDK but crashes in OpenJDk Pulse audio impl.
clip.open(ais);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
clip.start();
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
The current work around is to check isOpen() before calling stop.
SUPPORT :
YES