Mediafoundation 無法破譴某些 NVIDIA 卡上的視頻



我们使用SharpDX.NET包装器Mediafoundation将MP4视频解码为DirectX9纹理。这工作正常,除了它在某些NVIDIA卡上崩溃,例如940MX.例如,同一台带有英特尔高清显卡的机器可以很好地解码视频流。

不幸的是,除了来自SharpDX的E_FAIL/未指定错误之外,我们无法获得任何其他详细信息。即使启用了调试层。任何想法如何找出它崩溃的原因?

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();

如果是MX(移动芯片(,则很可能是最佳设置。您需要转到 nVidia 控制面板并添加一个明确的规则,您的应用程序需要专门使用 Intel 或 nVidia GPU,而不是自动检测。

最新更新