[RFC PATCH v2 02/13] libcamera: simple: Increase the default number of streams to 2

Milan Zamazal mzamazal at redhat.com
Fri Jan 24 22:57:53 CET 2025


In order to allow providing a raw stream together with a processed
stream, we need two streams.  If only one stream is eventually
requested, it doesn't harm to allocate two.

This is a hack for the lack of a better easy option.  The number of
streams is determined as a camera property in the pipeline matching.
The actual number of streams needed (one or two) is determined only when
examining roles in SimplePipelineHandler::generateConfiguration.

It's not obvious what to do better about the number of the streams.  It
seems that hardware pipelines utilize separate hardware streams while
with software ISP we have only a single input for multiple outputs.  A
fixed number of streams also doesn't scale but is good enough for our
current use case, which is supporting a single processed + a single raw
stream, not more.

Signed-off-by: Milan Zamazal <mzamazal at redhat.com>
---
 src/libcamera/pipeline/simple/simple.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 8ac24e6e..6e9bc630 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -1549,7 +1549,12 @@ int SimplePipelineHandler::resetRoutingTable(V4L2Subdevice *subdev)
 bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)
 {
 	const SimplePipelineInfo *info = nullptr;
-	unsigned int numStreams = 1;
+	/*
+	 * Let's allocate two streams, for processed + raw streams.
+	 * It's OK if there is only a single stream.
+	 * TODO: This should be more flexible.
+	 */
+	unsigned int numStreams = 2;
 	MediaDevice *media;
 
 	for (const SimplePipelineInfo &inf : supportedDevices) {
-- 
2.48.1



More information about the libcamera-devel mailing list