[libcamera-devel] [PATCH v5 09/12] pipeline: raspberrypi: Validate OptionalStream in queueRequestDevice()

Naushir Patuck naush at raspberrypi.com
Wed Jan 18 09:59:50 CET 2023


Add some validation in queueRequestDevice() to ensure that a frame buffer is
provided in a Request if the MandatoryRequestBuffer flag has not been set in
the StreamConfiguration for every configured stream.

Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 13d0ab4c4968..39f48e0a57fb 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1153,6 +1153,13 @@ int PipelineHandlerRPi::queueRequestDevice(Camera *camera, Request *request)
 			stream->setExternalBuffer(buffer);
 		}
 
+		if (!(stream->configuration().hints & StreamConfiguration::Hint::OptionalStream) &&
+		    !buffer) {
+			LOG(RPI, Error) << "No buffer provided for mandatory stream "
+					<< stream->name();
+			return -EINVAL;
+		}
+
 		/*
 		 * If no buffer is provided by the request for this stream, we
 		 * queue a nullptr to the stream to signify that it must use an
-- 
2.25.1



More information about the libcamera-devel mailing list