diff options
author | Naushir Patuck <naush@raspberrypi.com> | 2020-09-18 10:42:29 +0100 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2020-09-21 13:10:48 +0200 |
commit | b752c57c33151eff5b0e003a24f05a4e05465b1f (patch) | |
tree | 9596fdc005a53e2c021b6e1a758899e4c63e0c25 /src/libcamera/pipeline/raspberrypi/rpi_stream.h | |
parent | 45430e12ee74a92a46d8f6b92ba6bb647868ba3f (diff) |
libcamera: pipeline: raspberrypi: Add more robust stream buffer logic
Add further queueing into the RPiStream object to ensure that we always
follow the buffer ordering (be it internal or external) given by
incoming Requests.
This is essential, otherwise we risk dropping frames that are meant to
be part of a Request, and can cause the pipeline to stall indefinitely.
This also prevents any possibility of mismatched frame buffers going
through the pipeline and out to the application.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/libcamera/pipeline/raspberrypi/rpi_stream.h')
-rw-r--r-- | src/libcamera/pipeline/raspberrypi/rpi_stream.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.h b/src/libcamera/pipeline/raspberrypi/rpi_stream.h index 73954ec7..f42e25b9 100644 --- a/src/libcamera/pipeline/raspberrypi/rpi_stream.h +++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.h @@ -57,6 +57,7 @@ public: private: void clearBuffers(); + int queueToDevice(FrameBuffer *buffer); /* * Indicates that this stream is active externally, i.e. the buffers @@ -73,7 +74,7 @@ private: /* The actual device stream. */ std::unique_ptr<V4L2VideoDevice> dev_; - /* All framebuffers associated with this device stream. */ + /* All frame buffers associated with this device stream. */ std::vector<FrameBuffer *> bufferList_; /* @@ -84,6 +85,16 @@ private: std::queue<FrameBuffer *> availableBuffers_; /* + * List of frame buffers that are to be queued into the device from a Request. + * A nullptr indicates any internal buffer can be used (from availableBuffers_), + * whereas a valid pointer indicates an external buffer to be queued. + * + * Ordering buffers to be queued is important here as it must match the + * requests coming from the application. + */ + std::queue<FrameBuffer *> requestBuffers_; + + /* * This is a list of buffers exported internally. Need to keep this around * as the stream needs to maintain ownership of these buffers. */ |