libcamera: v4l2_videodevice: Empty the V4L2 buffer cache on streamOff()

When streamOff() is called, ensure the cache entries for the remaining queued
buffers are freed since this will not happen via the dequeueBuffer() mechanism.

Additionally, add a V4L2BufferCache::isEmpty() function and assert that the
cache is empty at the end of the streamOff() call.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Naushir Patuck 2022-03-25 09:09:02 +00:00 committed by Laurent Pinchart
parent 1fb71a6ffa
commit 5704856681
2 changed files with 17 additions and 0 deletions

View file

@ -124,6 +124,7 @@ public:
V4L2BufferCache(const std::vector<std::unique_ptr<FrameBuffer>> &buffers);
~V4L2BufferCache();
bool isEmpty() const;
int get(const FrameBuffer &buffer);
void put(unsigned int index);