DirectShowLib - 不能拿多张图片有网络摄像头。 得到了“存在不足的系统资源来完成

2019-07-31 03:49发布

我工作的Visual Studio 2012,并使用C#,我使用的库DirectShowLib拍照从我的摄像头,但我只能拿一张照片,如果我尝试采取另一个我得到一个异常:

   DirectShowLib.DsError.ThrowExceptionForHR(Int32 hr)
   at SnapShot.Capture.SetupGraph(DsDevice dev, Int32 iWidth, Int32 iHeight, Int16 iBPP, Control hControl) in c:\Users\devel_000\Documents\Visual Studio 2012\Projects\ControlAcceso\ControlAcceso\Capture.cs:line 323
   at SnapShot.Capture..ctor(Int32 iDeviceNum, Int32 iWidth, Int32 iHeight, Int16 iBPP, Control hControl) in c:\Users\devel_000\Documents\Visual Studio 2012\Projects\ControlAcceso\ControlAcceso\Capture.cs:line 86
   at ControlAcceso.PhotoWindow..ctor() in c:\Users\devel_000\Documents\Visual Studio 2012\Projects\ControlAcceso\ControlAcceso\PhotoWindow.cs:line 32
   at ControlAcceso.CheckWindow.pbPhoto_Click(Object sender, EventArgs e) in c:\Users\devel_000\Documents\Visual Studio 2012\Projects\ControlAcceso\ControlAcceso\CheckWindow.cs:line 108
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at ControlAcceso.Program.Main() in c:\Users\devel_000\Documents\Visual Studio 2012\Projects\ControlAcceso\ControlAcceso\Program.cs:line 18
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

我使用的是DxSnap例如[链接]以拍摄照片。 该异常的方法中SetupGraph抛出[链接]

该生产线DirectShowLib.DsError.ThrowExceptionForHR(Int32 hr)引起了我的注意,这是什么意思? 我怎样才能解决这个问题?

Answer 1:

错误-21470234460x800705AAERROR_NO_SYSTEM_RESOURCES “存在不足的系统资源完成所请求的服务。” (见这篇文章和工具阅读HRESULT容易价值观和便捷的方式)。

我要说最有可能你正在试图打开第二管道,但不关闭第一。 视频采集设备独占方式打开,因此如果有另外一个仍处于活动状态,你无法启动管道。 错误代码提示正是这一点。

为了工作这周围,你需要确保你打电话IMediaControl.Stop以前的过滤器图表,并释放你不要再和需要COM接口Marshal.ReleaseComObject



文章来源: DirectShowLib - Can't take more than one picture with webcam. Got “Insufficient system resources exist to complete the requested service” error