Fixed lost frames by using a ring buffer for images.