<Sound Dev> AudioSystem.getMixerInfo() takes about 30 sec to report a gone audio device

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue Jan 7 22:22:57 UTC 2020


Hi, Marcus.

I think the reason is this:
src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_DirectSound.cpp

=============
/* half a minute to wait before device list is re-read */
#define WAIT_BETWEEN_CACHE_REFRESH_MILLIS 30000
=============

This delay really looks too big, can you please file a bug:
https://bugs.java.com/bugdatabase/

On 1/7/20 9:53 am, marcusl wrote:
> Hi there,
> 
> I'm running a Java program under Windows 7 which just fetches the audio
> devices via the AudioSystem.getMixerInfo() and checks for a specific device.
> This device is a USB audio device. When the device gets plugged into the
> computer it takes about 3 sec until it is recognized by the AudioSystem. So
> no problem here. But if the device has been unplugged it takes about 30 sec
> until this situation is correctly reported by the AudioSystem. This happens
> with every USB-device.
> 
> So, I just want to ask if this is because of the JVM<->Windows communication
> or if there is some timeout hidden throughout the audio system
> implementation. I can totally live with the 30 sec if there is no sane way
> to reduce this time. But I'm also interested in the "why".
> 
> Thanks in advance
> 
> Marcus
> 
> 
> 
> --
> Sent from: http://openjdk.5641.n7.nabble.com/OpenJDK-Sound-API-Development-f102085.html
> 


-- 
Best regards, Sergey.


More information about the sound-dev mailing list