1

I am using a new usb camera with DirectShow.

For some reason, the calls to BufferCB get progressively slower till I get 1 call every 10 seconds. The initial frame rate is about 15 fps.

I removed any code from BufferCB that could be causing a block but it still happens.

I try using the camera in regular web-cam software and it seems to be fine.

Can anyone give me an pointers as to where I should look to investigate this???

BufferCB calls blocks till it returns but this does not seem to be the problem.

Here is some code:

   if (this.graphBuilder.Connect(
                            this.CameraFilter.GetPin(PinDirection.Output, 0),
                            this.grabberFilter.GetPin(PinDirection.Input, 0)) >= 0)
{
    if (this.sampleGrabber.GetConnectedMediaType(mediaType) != 0)
    {
        return false;
    }

    var header = (VideoInfoHeader)Marshal.PtrToStructure(
        mediaType.FormatPtr,
        typeof(VideoInfoHeader));
    this.DefaultWidth = header.BmiHeader.Width;
    this.DefaultHeight = header.BmiHeader.Height;
    this.sampleGrabberCallback.Width = header.BmiHeader.Width;
    this.sampleGrabberCallback.Height = header.BmiHeader.Height;
}  

     if (this.graphBuilder.Render(this.grabberFilter.GetPin(PinDirection.Output, 0)) != 0)
     {
        return false;
     }

     if (this.sampleGrabber.SetBufferSamples(false) != 0)
     {
         return false;
     }

     if (this.sampleGrabber.SetOneShot(false) != 0)
     {
          return false;
     }

     if (this.sampleGrabber.SetCallback(this.sampleGrabberCallback, 1) != 0)
     {
         return false;
     }

: : :

I have made BufferCB() an empty stub...to test and the problem persists...

Any ideas???

user3079907
  • 133
  • 1
  • 10
  • Actually, it appears to only happen when I use a high resolution. Low resolutions are fine at about 30fps. – user3079907 Apr 21 '18 at 07:03
  • Actually, under further investigation the problem seems to be with MJPG streams from the camera using either DirectShow or Media Foundation interfaces. The camera sensor is "CMOS OV2710" and I am using Windows 10 vs 10.0.17134....There seems to be a problem with MJPG streams. Both DirectShow and Media Foundation enumerate and let me connect to the stream, in both cases the frame rate gradually falls to 1 frame per second. – user3079907 Jun 07 '18 at 15:08
  • The only related issue I can find is:https://stackoverflow.com/questions/38786309/webcam-mjpg-capture-streams-are-unavailable-on-windows-10 I have tried using Roman R's registry update and this had no effect.... – user3079907 Jun 07 '18 at 15:09

0 Answers0