Possible fix for bug 5010 - SDL_Init with SDL_INIT_JOYSTICK hangs for 10 seconds when playing audio from another application

Jake Breen

When I run SDL_INIT with SDL_INIT_JOYSTICK it stalls for about 10 seconds (last report was 10,615ms), but only if I'm currently playing audio. (Like in Spotify for example.)

querying something related to device access (last dll loaded)
'BabbysFirst64.exe' (Win32): Loaded 'C:\Windows\SysWOW64\deviceaccess.dll'.

I use a USB DAC because my mobo's audio out is pretty not great. And I've noticed unplugging it seems to solve the issue. I haven't noticed any other issues that are caused by my DAC.

My DAC is the Sound BlasterX G1 https://us.creative.com/p/gaming-headsets/sound-blasterx-g1
Vid = 041E
PID = 3249

My system specs:
- Windows 10 Pro
- Ryzen 2700x
- 16GB Ram
- Nvidia 2070 RTX

Additional USB devices plugged in:
- Valve Index
- Xbox One Elite Controller
This commit is contained in:
Sam Lantinga 2020-03-02 15:06:47 -08:00
parent a19757ac8d
commit 3b3ae4d14d
2 changed files with 6 additions and 2 deletions

View File

@ -1687,10 +1687,13 @@ static SDL_bool SDL_IsPS4RemapperRunning(void)
SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid) SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
{ {
/* This list is taken from: /* This list (except for marked entries at the top) is taken from:
https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py
*/ */
static Uint32 joystick_blacklist[] = { static Uint32 joystick_blacklist[] = {
/* Sound BlasterX G1 */
MAKE_VIDPID(0x041E, 0x3249),
/* Microsoft Microsoft Wireless Optical Desktop® 2.10 */ /* Microsoft Microsoft Wireless Optical Desktop® 2.10 */
/* Microsoft Wireless Desktop - Comfort Edition */ /* Microsoft Wireless Desktop - Comfort Edition */
MAKE_VIDPID(0x045e, 0x009d), MAKE_VIDPID(0x045e, 0x009d),

View File

@ -413,7 +413,7 @@ HIDAPI_GetDeviceDriver(SDL_HIDAPI_Device *device)
const Uint16 USAGE_GAMEPAD = 0x0005; const Uint16 USAGE_GAMEPAD = 0x0005;
const Uint16 USAGE_MULTIAXISCONTROLLER = 0x0008; const Uint16 USAGE_MULTIAXISCONTROLLER = 0x0008;
int i; int i;
SDL_GameControllerType type = SDL_GetJoystickGameControllerType(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol); SDL_GameControllerType type;
if (SDL_ShouldIgnoreJoystick(device->name, device->guid)) { if (SDL_ShouldIgnoreJoystick(device->name, device->guid)) {
return NULL; return NULL;
@ -426,6 +426,7 @@ HIDAPI_GetDeviceDriver(SDL_HIDAPI_Device *device)
return NULL; return NULL;
} }
type = SDL_GetJoystickGameControllerType(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol);
for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) { for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) {
SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i]; SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i];
if (driver->enabled && driver->IsSupportedDevice(device->name, type, device->vendor_id, device->product_id, device->version, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol)) { if (driver->enabled && driver->IsSupportedDevice(device->name, type, device->vendor_id, device->product_id, device->version, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol)) {