PDA

View Full Version : Ring Buffer, Dropped frames



fayard
April 27, 2017, 11:00:16
Hi,

I am using a DFK22AUC03 with the C++ SDK on Windows 10. There are still a few things that I don't understand using the SDK.

I have played around with the "Callback" example, which I understand as it is. But suppose that you tweak it and set:

- the ring buffer has room for 1 image
- we are in snap mode
- the camera runs at 30 images per seconds
- the listener (frameReady) needs 1 second to process
- you ask for 60 images using pSink->snapImages(60);

My understanding is that once the first image is ready, we call the frameReady function. My guess is that while this function is running, the buffer containing this image is locked. As a consequence, there is no way to save the images coming from the camera, and as a consequence, images should be dropped.
But, calling grabber.getCountOfFramesDropped() gives me 0 even though grabber.isCountOfFramesDroppedAvailable() is true. Even more strange grabber.getCountOfFramesNotDropped() also returns 0.

Could you please clarify on what's going on? When do we drop frames?

Stefan Geissler
April 27, 2017, 16:33:58
Hello

If grabber.getCountOfFramesDropped() is supported by the device, it lets you know, the number of frames dropped by the driver. Not by the SDK.

fayard
April 28, 2017, 10:05:06
Hello
If grabber.getCountOfFramesDropped() is supported by the device, it lets you know, the number of frames dropped by the driver. Not by the SDK.

Thanks for the clarification, even though I don't quite understand how the information travels from the sensor to the ring buffer in the SDK. It would be nice to have such a thing in the documentation.

But I also don't understand why .getCountOfFramesNotDropped() also returns 0.

Stefan Geissler
April 28, 2017, 11:58:36
The image travels from the camera to the USB controller. The USB controller saves the image into allocated memory via DMA on the computer. Then the USB controller notifies the driver about the new image. The driver takes the image, if it is ok, and forwards it to the DirectShow pipeline for making necessary stuff, e.g. color space transform. That is the part that runs in the SDK too.

If frame ready is not called for a frame, then this does not necessarily mean, the camera and driver lost a frame. Therefore no frame drop.