[libcamera-devel] [PATCH] pipeline: simple: Fix an issue in breadth-first search

Phi-Bang Nguyen pnguyen at baylibre.com
Sun Apr 4 23:03:53 CEST 2021


When seting up the pipeline, the latest entity in the queue is
taken but the oldest one is poped. This is a mistake. Fix it.

Fixes: 4671911df040 ("pipeline: simple: Use breadth-first search
to setup media pipeline")

Signed-off-by: Phi-Bang Nguyen <pnguyen at baylibre.com>
---
 src/libcamera/pipeline/simple/simple.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index f81a4d15..a2dbc336 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -288,12 +288,12 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,
 
 	/* Remember at each entity where we came from. */
 	std::unordered_map<MediaEntity *, Entity> parents;
-	queue.push(sensor);
-
 	MediaEntity *entity = nullptr;
 
+	queue.push(sensor);
+
 	while (!queue.empty()) {
-		entity = queue.back();
+		entity = queue.front();
 		queue.pop();
 
 		/* Found the capture device. */
-- 
2.25.1



More information about the libcamera-devel mailing list