各位大侠:为什么DirectShow开发的摄像头运行一段时间后会死机呢?
          一般是什么原因造成死机的呢?
          感谢了~~~!

解决方案 »

  1.   

    检查一下内存和cpu占用率是不是太大了
      

  2.   


      int ISampleGrabberCB.BufferCB(double SampleTime, IntPtr pBuffer, int BufferLen)
            {
                // 画图形至每一帧
                using (Bitmap v = new Bitmap(m_videoWidth, m_videoHeight, m_stride, PixelFormat.Format32bppArgb, pBuffer))
                {
                    using (Graphics g = Graphics.FromImage(v))
                    {
                        //g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                        g.DrawImage(bitmapOverlay, 0, 0, m_videoWidth, m_videoHeight);
                    }
                    if (m_bNeedGrap)
                    {
                        m_bmpGrapImage = (Bitmap)(v.Clone());
                        m_bNeedGrap = false;
                    }
                    //v.RotateFlip(RotateFlipType.Rotate90FlipY);
                  
                }
                return 0;
            }可是我用的USING,没用一次我就释放了
      

  3.   

    或者这样问吧:DirectShow 为什么要释放Marshal.ReleaseComObject() IBaseFilter这个非托管资源,如果不释放有什么后果?