Asked by:
Long hang on IAudioClient Initialize()

Question
-
This is an issue that I see very infrequently, but have seen a few times. It has impacted some important customers, causing them to miss calls. I'd like to further my understanding of what could be happening here.
In the problematic scenarios, there appears to be a long delay (even up to 30 seconds!) when initializing an IAudioClient. The logs also indicate that all WASAPI calls succeeded. The flow is as follows:
hr = pAudioClient->GetMixFormat((WAVEFORMATEX **)&pMixFormatEx); if (FAILED(hr)) { // Log and error } // Log the mix format (LOG #1) hr = pAudioClient->Initialize( AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, 100 * 10000, 0, &pMixFormatEx->Format, NULL); if (FAILED(hr)) { // Log and error } // Log that the device was initialized (LOG #2)
This works without fail 99.9% of the time. However, this last time, we saw a 30 second interval between LOG #1 and LOG #2 (before the Initialize() call and after the Initialize() call).
Is it possible that something in the Initialize() call is blocking or causing this horrendous hang?
There was no mention of a system hang or any other issue with running applications when the issue was encountered.
- Windows 7
- Microphone (Realtek High Definition Audio), mix format 48 KHz 32-bit float
Please let me know if there is something I can look into, or if there is other information I can provide.
- Edited by Jim M B Tuesday, January 9, 2018 6:37 PM
Tuesday, January 9, 2018 6:36 PM
All replies
-
Update:
Apparently this is not as infrequent as previously thought. One customer is experiencing this on a frequent basis (3 second wait, 20 second wait, 25 second wait). Will have the customer update drivers and try a different device. I'll report back if that makes a difference.
There apparently was another thread a few years ago dealing with the same issue:
Wondering if there was any resolution (none found on the thread).
- Edited by Jim M B Tuesday, January 9, 2018 9:29 PM
Tuesday, January 9, 2018 7:28 PM -
Your application isn't doing anything wrong, this would seem to be a bug in Windows.
If you can get a repro on Windows 10, file a problem report in Feedback Hub under Devices and Drivers / Audio and sound, and include logs of the problem in action. See https://blogs.msdn.microsoft.com/matthew_van_eerde/2016/09/26/report-problems-with-logs-and-suggest-features-with-the-feedback-hub/
Once filed, grab a direct link to the problem report from Feedback Hub / Feedback / My feedback / (click on the problem report in question) / Share
Send me the link
Matthew van Eerde
Wednesday, January 10, 2018 11:37 AM -
We haven't seen any cases on Windows 10 -- any use in filing a problem report for Windows 7?
Wednesday, January 31, 2018 5:39 PM -
For Windows 7 your best bet is to open a support case on https://support.microsoft.com/
Matthew van Eerde
Wednesday, January 31, 2018 5:43 PM -
This problem seems more easily happen in these audiodevice drivers:
Realtek High Definition Audio 6.0.1.6383,6.0.1.6895,6.0.1.7581,6.0.1.8295,6.0.1.7989
Conexant SmartAudio HD 8.54.40.0, 8.54.29.0
IDT High Definition Audio CODEC 6.10.6454.0Tuesday, August 28, 2018 3:47 AM -
This problem happend not noly on IAudioClient Initialize() but alos on waveopen() on some machines.
And I have tried system's recorder. It also may be hanged on some machines.
Accoding to statistics by our voip app , the hang will happen at about 1/70 machines, mostly when the fisrt time call this api after starting the matchine(All kinds of audio device drivers).
Thursday, August 30, 2018 11:59 AM -
If you can get a repro on Windows 10, file a problem report in Feedback Hub under Devices and Drivers / Audio and sound, and include logs of the problem in action. See https://blogs.msdn.microsoft.com/matthew_van_eerde/2016/09/26/report-problems-with-logs-and-suggest-features-with-the-feedback-hub/
Once filed, grab a direct link to the problem report from Feedback Hub / Feedback / My feedback / (click on the problem report in question) / Share
Send me the link
Matthew van Eerde
Tuesday, September 4, 2018 4:49 PM -
We are having the same issue 100% of the time. Takes about 30 seconds for IAudioClient::Initialize to complete, although successfully. Are there any plans to fix this in the upcoming Windows updates?Tuesday, November 12, 2019 7:28 PM