<Sound Dev> [11] Review Request: 8202264 Race condition in AudioClip.loop()
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Mon Jul 9 11:25:37 UTC 2018
Hello, Audio Guru.
Please review the fix for jdk11.
Bug: https://bugs.openjdk.java.net/browse/JDK-8202264
Webrev: http://cr.openjdk.java.net/~serb/8202264/webrev.00
Our implementation of "java.applet.AudioClip" is a wrapper for
"javax.sound.sampled.Line", which should be closed after usage.
We close the line in two situations:
1. When finalize() is called for the AudioClip.
2. When the AudioClip is inactive 5 seconds after creation(at the
moment of check).
The second case has some issues:
- The clip can be closed automatically not after 5 seconds from the
last activity, but even if the clip is actively used but inactive
exactly at 5 seconds after creation.
- The clip can be closed automatically when(or immediately after) the
user will try to play some sounds.
In the fix I have disabled auto-closing, when the user tries to play the
sounds. As a side effect we will close the clip after 5 seconds of
inactivity.
--
Best regards, Sergey.
More information about the sound-dev
mailing list