Hey, I found strange behaviour with libargus using it in mailbox mode. I have read this description:
MAILBOX: In this mode, only the newest frame is made available to the consumer. When Argus completes a frame it empties the mailbox and inserts the new frame into the mailbox. The consumer then retrieves the frame from the mailbox and processes it; when finished, the frame is either placed back into the mailbox (if the mailbox is empty) or discarded (if the mailbox is not empty). This mode implies 2 things:
- If the consumer consumes frames slower than Argus produces frames, then some frames may be lost (never seen by the consumer).
- If the consumer consumes frames faster than Argus produces frames, then the consumer may see some frames more than once.
FIFO: When using this mode, every producer frame is made available to the consumer through the use of a fifo queue for the frames. When using this mode, the fifo queue length must be specified using setFifoLength. When Argus completes a frame it inserts it to the head of the fifo queue. If the fifo is full (already contains the number of frames equal to the fifo queue length), Argus will stall until the fifo is no longer full. The consumer consumes frames from the tail of the queue; however, if the consumer releases a frame while the queue is empty, the frame is set aside and will be returned again the next time the consumer requests a frame if another new frame has not been inserted into the fifo queue before then. Once a new frame is inserted into the fifo queue, any previously released frame will be permanently discarded. This mode implies:
The behaviour I found does not match the description in general. (Frames are never presented to me multiple times in any mode, even when I consume fasther than produce) But this is not my problem.
My problem is that in MAILBOX Mode if I add some post-processing frames get lost. But that is not because my processing takes too long. It just takes 3ms. I timed the time waiting idle for a new frame and this time changes between 11ms and 85ms. My fps is 40, so I should not wait longer for one frame than 50ms max.
How come there is one missing? Does Mailbox Mode need the release of the old frame in less than 3 milliseconds so it can be filled again? Maybe the issue is there.