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???