-
Notifications
You must be signed in to change notification settings - Fork 541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try to recover from AUDCLNT_E_DEVICE_INVALIDATED errors in wasapi #237
base: master
Are you sure you want to change the base?
Conversation
This looks like it can change the device format, which wouldn't be good since the rest of the device isn't updated to account for it. And the device shouldn't spontaneously change format on the app. A better and more general option may be to have |
hi, about the race condition: yeah I'm not too confident.. If it helps you remembering the problem with alcResetDeviceSOFT() recovering a disconnected device, what you said at the time was:
So yes indeed we are lying during the recovery period, pretending all is fine. but that's kind of the point of the change. And it is at least coherent from the application perspective, since it stays connected the whole time until failure. about the change of the device format: I know that changing the bitrate and bit depth (in the windows sound card configuration dialog) seem to work fine. I don't remeber what happens when changing the number of channels, I'll have to test. |
As expected, changing the speaker layout / number of channels doesn't work at all. I'll try to add something like DEVICE_CHANNELS_REQUEST to keep the device in the same state or fail. |
That's not necessary for |
How about this approach:
and maybe some hint at device creation "allow device frequency to change" to recover more cases? |
I'd be curious how often this happens and would work. What would cause a device to disconnect that doesn't change the sample rate, period size, or channel configuration, and such that it can be recovered with little delay? I think having
Maybe. I'm still a bit leery on doing too much without the app realizing anything happened, but we'll see. There's a number of potential paths to take with regard to sample rate mismatches. |
…kend. Instead of disconnecting the device and passing the error onto the application, try to recover from the error in the mixing loop.
0764d10
to
7a84d94
Compare
So I've created an other pull request with an attempt to make I've also changed this one, should you want to pull it:
Now, please note that I've tried to reproduce the issues that prompted me to make the changes without success. It looks like since earlier this year, windows 10/the drivers have been updated..
So now the only wait I have to produce AUDCLNT_E_DEVICE_INVALIDATED errors is by manually changing the devices properties in the windows control panel. |
I can reproduce something similar, when I switch from desktop resolution to another fullscreen resolution. e.g. desktop is 2560x1440 and game using openal is configured to 1920x1080 fullscreen. is this somehow related to this discussion (see answer from Ronald_Intel ) |
Instead of disconnecting the device and passing the error to the application, try to recover from the error in the mixing loop.
The error is triggered on some configurations when switching to fullscreen mode, or with some usb headsets. And it can take a few seconds to recover.
It also occurs when changing the sound card default sample rate in the windows configuration dialog.