We are using the SharpDX
.NET wrapper to make Mediafoundation
decode an MP4 Video into a DirectX9
texture. This works fine, except that it crashes on certain NVIDIA
cards for example the 940MX
. For example the same machine with an Intel HD graphics card decodes the video stream fine.
Unfortunately we cant get any other details than a E_FAIL/Unspecified error from SharpDX
. Even with the debug layer enabled. Any ideas how to find out why it crashes?
VideoMediaType outputVideoFormat;
MediaFactory.CreateVideoMediaTypeFromSubtype(mFormatYv12Guid, out outputVideoFormat);
if (outputVideoFormat == null)
{
Trace.WriteLine("Error: create output video format failed.");
return false;
}
outputVideoFormat.Set(MediaTypeAttributeKeys.Subtype, mFormatYv12Guid);
outputVideoFormat.Set(MediaTypeAttributeKeys.FrameSize, size);
sourceReader.SetCurrentMediaType(mVideoStreamIndex, outputVideoFormat);
outputVideoFormat.Dispose();
IntPtr transformPointer = sourceReader.GetServiceForStream(mVideoStreamIndex, Guid.Empty, typeof(Transform).GUID);
if (transformPointer.ToInt64() <= 0)
{
Trace.WriteLine("Error: videoDecoderPointer is null");
return false;
}
Transform videoDecoder = new Transform(transformPointer);
// crashing here with E_FAIL/Unspecified error
videoDecoder.ProcessMessage(TMessageType.SetD3DManager, deviceManager.NativePointer);
videoDecoder.Dispose();