From 0373490ef64340ed42a21500b6f9a3575b890ba5 Mon Sep 17 00:00:00 2001 From: Phi-Bang Nguyen Date: Fri, 2 Apr 2021 17:10:43 +0200 Subject: pipeline: simple: Fix an issue in breadth-first search 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 Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- 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 03d980c6..f6095d38 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -287,12 +287,12 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe, /* Remember at each entity where we came from. */ std::unordered_map 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. */ -- cgit v1.2.1