MFT NVENC H264/HEVC Encoder Crash

Hi,

I am receiving a crash when using a Media Foundation Transform encoder outputting both H.264 and HEVC. I am using a slight adaptation of the code found here, https://github.com/webrtc-uwp/webrtc-windows/blob/d721489f144d8446ae429b69b9dc2768927c9c04/third_party/winuwp_h264/H264Encoder/H264Encoder.cc, to support hardware accelerated encoding with D3D11.

The stack trace I receive is shown below, however this gives minimal information to me. I suspect there may be an issue related to the call to the InitEncoderWithSettings within the SetRates function (line 258). Would there be any unexpected behaviour reconfiguring the encoder whilst encoding? The maximum rate of change within the code is 5 seconds, would there be any further issues doing this at a faster rate?

I have the Nvidia Display Driver V516.94 installed.

0x00007FF814093416 (ntdll) RtlWaitOnAddress
0x00007FF81405FCB4 (ntdll) RtlEnterCriticalSection
0x00007FF81405FAE2 (ntdll) RtlEnterCriticalSection
0x00007FFFF705F75D (nvEncMFTH264x) DllGetClassObject
0x00007FFFF705AD0C (nvEncMFTH264x) DllGetClassObject
0x00007FF808E186CD (RTWorkQ) RtwqAllocateSerialWorkQueue
0x00007FF814092150 (ntdll) TpAllocPool
0x00007FF81408315A (ntdll) TpReleaseCleanupGroupMembers
0x00007FF813E57034 (KERNEL32) BaseThreadInitThunk
0x00007FF814082651 (ntdll) RtlUserThreadStart

Thanks,

Aidan