Under load, I am getting an occasional AccessViolation in WDMAUD.DRV, and my application is crashing.
Comments: No - it doesn't fail in the same way.... We modified the WaveInBuffer so that the header handle is pinned - we believe this fixed the accessViolation exception. However we were then getting an occasional EngineExecution exception, which appears to be in the Callback handler in WaveIn. Sometimes the Callback is being called with either a null buffer, or a corrupt one (IsQueued = true, etc). We have modified the code such that the first thing the Callback handler does is check the recording flag, and abort if it is not set i.e. : ``` private void Callback(IntPtr waveInHandle, WaveInterop.WaveMessage message, IntPtr userData, WaveHeader waveHeader, IntPtr reserved) { if (message == WaveInterop.WaveMessage.WaveInData) { if (recording) { var hBuffer = (GCHandle)waveHeader.userData; var buffer = (WaveInBuffer)hBuffer.Target; ``` __This appears to have solved the issue__
Comments: No - it doesn't fail in the same way.... We modified the WaveInBuffer so that the header handle is pinned - we believe this fixed the accessViolation exception. However we were then getting an occasional EngineExecution exception, which appears to be in the Callback handler in WaveIn. Sometimes the Callback is being called with either a null buffer, or a corrupt one (IsQueued = true, etc). We have modified the code such that the first thing the Callback handler does is check the recording flag, and abort if it is not set i.e. : ``` private void Callback(IntPtr waveInHandle, WaveInterop.WaveMessage message, IntPtr userData, WaveHeader waveHeader, IntPtr reserved) { if (message == WaveInterop.WaveMessage.WaveInData) { if (recording) { var hBuffer = (GCHandle)waveHeader.userData; var buffer = (WaveInBuffer)hBuffer.Target; ``` __This appears to have solved the issue__