Mediafoundation无法解码某些NVIDIA卡上的视频 [英] Mediafoundation cant decode video on certain NVIDIA cards

查看:87
本文介绍了Mediafoundation无法解码某些NVIDIA卡上的视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用 SharpDX .NET包装器来使 Mediafoundation 将MP4视频解码为 DirectX9 纹理.除在某些 NVIDIA 卡(例如 940MX )上崩溃外,此方法工作正常.例如,具有Intel HD图形卡的同一台机器可以很好地解码视频流.

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.

很遗憾,除了 SharpDX 的E_FAIL/Unspecified错误之外,我们无法获得其他任何详细信息.即使启用了调试层.有什么想法如何找出崩溃的原因吗?

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

推荐答案

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

It's likely if it's a MX (mobile chip) that it's an optimus setup. You'll need to go to the nVidia control panel and add an explicit rule that your application needs to either specifically use the Intel or nVidia GPU rather than autodetecting.

这篇关于Mediafoundation无法解码某些NVIDIA卡上的视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆