AudioEncodingProperties aep = AudioEncodingProperties.CreatePcm(8000, 1, 16)
audioDescriptor = new AudioStreamDescriptor(aep)
The above code works most of the time. An app's analytics reports that new AudioStreamDescriptor(aep) occasionally throws:
System.Runtime.InteropServices.COMException: Class not registered (Exception from HRESULT: 0x80040154)
Stack Trace:
at System.Runtime.InteropServices.ExternalInterop.RoGetActivationFactory(String, Guid&, IntPtr&) + 0x197
at System.Runtime.InteropServices.FactoryCache.GetActivationFactoryInternal(String, RuntimeTypeHandle, ContextEntry) + 0x4a
at System.Runtime.InteropServices.FactoryCache.GetActivationFactory(String, RuntimeTypeHandle, Boolean) + 0x6c
at System.Runtime.InteropServices.McgMarshal.GetActivationFactory(String, RuntimeTypeHandle) + 0x24
at Windows.Media.Core.AudioStreamDescriptor.__Factory_Windows_Media_Core__IAudioStreamDescriptorFactory_Create(String, AudioEncodingProperties) + 0x1b
at Windows.Media.Core.AudioStreamDescriptor..ctor(AudioEncodingProperties) + 0x21
Could anyone shed some light on the possible causes of this?