--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java Thu Jul 06 09:22:45 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java Thu Jul 06 15:54:39 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1351,18 +1351,14 @@
// pre-empted while another thread changes doIO and notifies,
// before we wait (so we sleep in wait forever).
synchronized(lock) {
- if (!doIO) {
+ while (!doIO && thread == curThread) {
try {
lock.wait();
- } catch(InterruptedException ie) {
- } finally {
- if (thread != curThread) {
- break;
- }
+ } catch (InterruptedException ignored) {
}
}
}
- while (doIO) {
+ while (doIO && thread == curThread) {
if (newFramePosition >= 0) {
clipBytePosition = newFramePosition * frameSize;
newFramePosition = -1;
--- a/jdk/test/ProblemList.txt Thu Jul 06 09:22:45 2017 -0700
+++ b/jdk/test/ProblemList.txt Thu Jul 06 15:54:39 2017 -0700
@@ -223,8 +223,6 @@
# jdk_sound
javax/sound/sampled/AudioInputStream/FrameLengthAfterConversion.java 8178401 windows-all
-javax/sound/sampled/Clip/ClipCloseLoss.java 8178403 generic-all
-
javax/sound/sampled/DirectAudio/bug6372428.java 8055097 generic-all
javax/sound/sampled/Clip/bug5070081.java 8055097 generic-all
javax/sound/sampled/DataLine/LongFramePosition.java 8055097 generic-all
--- a/jdk/test/javax/sound/sampled/Clip/ClipCloseLoss.java Thu Jul 06 09:22:45 2017 -0700
+++ b/jdk/test/javax/sound/sampled/Clip/ClipCloseLoss.java Thu Jul 06 15:54:39 2017 -0700
@@ -33,10 +33,9 @@
/**
* @test
- * @bug 4946913
+ * @bug 4946913 8178403
* @summary DirectClip doesn't kill the thread correctly, sometimes
* @run main/othervm ClipCloseLoss
- * @key intermittent
*/
public class ClipCloseLoss {
static int frameCount = 441000; // lets say 10 seconds
@@ -47,7 +46,7 @@
static int success = 0;
static boolean failed = false;
- public static void run(Mixer m) {
+ public static void run(Mixer m, long sleep) {
Clip clip = null;
try {
if (m == null) {
@@ -69,6 +68,8 @@
clip.open(new AudioInputStream(bais, format, frameCount));
out(" clip.close()");
+ // emulates a different delay between open() and close()
+ Thread.sleep(sleep);
//long t = System.currentTimeMillis();
clip.close();
//if (System.currentTimeMillis() - t > 1950) {
@@ -107,13 +108,15 @@
public static void main(String[] args) throws Exception {
if (isSoundcardInstalled()) {
bais.mark(0);
- run(null);
Mixer.Info[] infos = AudioSystem.getMixerInfo();
- for (int i = 0; i<infos.length; i++) {
- try {
- Mixer m = AudioSystem.getMixer(infos[i]);
- run(m);
- } catch (Exception e) {
+ for (int sleep = 0; sleep < 100; ++sleep) {
+ run(null, sleep);
+ for (int i = 0; i < infos.length; i++) {
+ try {
+ Mixer m = AudioSystem.getMixer(infos[i]);
+ run(m, sleep);
+ } catch (Exception e) {
+ }
}
}
out("Waiting 1 second to dispose of all threads");