1 | initial version |
unfortunately, the av-based linux capture code is using an internal fifo (5 frames, iirc), and you cannot clean (or say, flush) it.
so, change your logic. instead of sleeping for a long time (which will only queue up more buffers), you should read as fast as you can continuously, but only use frames, when you need them.
(pseudo code, sorry)
triggerTime=0
while True:
retr = cap1.grab()
retl = cap2.grab()
retr1, framer1 = cap1.retrieve(retr)
retl1, framel1 = cap2.retrieve(retl)
if triggerTime >= 2.0: #some value
#
# process both frames NOW !
#
triggerTime = 0 # reset
triggerTime += something