camera1394
camera1394 copied to clipboard
camera1394: Check if frames were dropped (diagnostics feature)
Just spotted a question on libdc1394 FAQ:
How can I find out if a frame was dropped from not calling dc1394_capture_dequeue() frequently enough?
After each DMA capture function call, you can check the value returned in the frames_behind member of the dc1394frame_t structure. If frames_behind is equal to the ring buffer size minus one then you may have dropped frames.
If you have reason to believe that frames are transmitted regularly (for example on an external trigger signal) then you could also check the filltime member returned in dc1394frame_t for any irregularities in the time series.
Frames can be dropped when dealing with a high frame rate camera on a slow system. So, implementing this in Camera1394::readData()
can be a good diagnostics feature.
To test it on our current hardware we may need to throttle down the read loop.
@jack-oquin, what do you think?
Also, Am I right in thinking that NUM_DMA_BUFFERS is the size of the ring buffer mentioned above?
Seems like a good idea.
The driver could publish dropped frame information to the /diagnostics topic.
Testing could be tricky. Maybe we could add a specific hz_rate parameter for unit test purposes.