summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2021-07-21 10:28:00 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-07-28 09:55:24 +0300
commite87fb20f8f5db9d54b9ca0bb0fdd8a1a9d30a8bd (patch)
treeacaa890eab4c264ea2ae3268b6120ed4c65fa535 /src
parentf573198d3e4200cc8e203ecf638c20f8ed41547a (diff)
pipeline: raspberrypi: Fix a bug when clearing out Request buffers on stop
When RPiCameraData::clearIncompleteRequests() clears out the request queue during a stop condition, it unconditionally calls completeBuffer() on all buffers in each request. This is wrong, as a buffer could have already been completed as part of the current request, but the request itself may not yet have completed. Fix this by checking if the buffers in the request have been completed before cancelling them. Fixes: d372aaa10ddb ("pipeline: raspberrypi: Simplify RPiCameraData::clearIncompleteRequests()") Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Tested-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index f821d8fe..0bab3bed 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1520,8 +1520,14 @@ void RPiCameraData::clearIncompleteRequests()
for (auto &b : request->buffers()) {
FrameBuffer *buffer = b.second;
- buffer->cancel();
- pipe_->completeBuffer(request, buffer);
+ /*
+ * Has the buffer already been handed back to the
+ * request? If not, do so now.
+ */
+ if (buffer->request()) {
+ buffer->cancel();
+ pipe_->completeBuffer(request, buffer);
+ }
}
pipe_->completeRequest(request);