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

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Apr 14 01:38:12 CEST 2021


Hi Phi-Bang,

Thank you for the patch, and sorry for the delay.

On Sun, Apr 04, 2021 at 11:03:53PM +0200, Phi-Bang Nguyen wrote:
> 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")

Minor issue, the Fixes: line shouldn't be wrapped (to make it easy for
scripts to parse it). I've fixed this and pushed the patch.

> Signed-off-by: Phi-Bang Nguyen <pnguyen at baylibre.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.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. */

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list