From patchwork Sun Apr 4 21:03:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phi-bang Nguyen X-Patchwork-Id: 11835 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id CDC97BD695 for ; Sun, 4 Apr 2021 21:04:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2B6E268787; Sun, 4 Apr 2021 23:04:27 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="KadKlyWq"; dkim-atps=neutral Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id ED60F6877C for ; Sun, 4 Apr 2021 23:04:25 +0200 (CEST) Received: by mail-wr1-x432.google.com with SMTP id a6so3295203wrw.8 for ; Sun, 04 Apr 2021 14:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RQzIuUQgZrycDpSkQWiGzWHc26o0OXGmSsI/bMpczf0=; b=KadKlyWqMcFNTGFY6vHb8L8JM126zKd9z40XrzmFq5ixTskH6S9aWAi8PLy/w/s62x Y7ff95X+q93VjZaLq5RLPyco/tYauQt1bTrNPhn4WauAKfocDJteL2ihmWv2y34JlGgJ P3XdD0LhI8tBIx7HQOu94ZetWiM+Iy6Q27O7NnXdc6j5AFLBkxihccCTtI5/S34mWELd 4R3tbcXTif6vpJ37Y2ZJKrbVPr689e/KjOMjsMMrRojL47+vOOBi0TF+I6rPMG19mJMG jyiQDTEB0vE/oz0JP+m++A/P4ZeyM+KO9dHBpZiBxyKoKLMffqRiCAx9OCF0yplAcCtk hSNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RQzIuUQgZrycDpSkQWiGzWHc26o0OXGmSsI/bMpczf0=; b=pzABXFfUq07tur59G0kPpOX/OX1DKKH+P6iA0CwPyBZ7zkUehQL4BNZfscZ0zEULPk P4DsjH51W9m0azmEmhKY+VNzYgvVOe4pV/ZWCCoxEJmsqVP/lZf2vLFC9gR5JD+7oVn5 RtZ3hJyije7jK+vHJJPDXc6r2IBAfmIoAgll7UnkBNDnRh5A31VVgMIP7huegkvtUKiV Qa3VwdH8WmsvqEtX+iwMRoakRNldQcPZIr2S+9hPmvVItVv9ZlJE4ZULoYdt5KBNdJZq tMcOQNL1LH+vCZIu3fblxbU5txT9q4WJArAPdKoeN4tIVve5W4luweAQCjDnr8S9P2je 6UzA== X-Gm-Message-State: AOAM532sfczGHcBux93wtF+OnLQ+Kyd+/CRWgDgSrXPO5czYXWKC4dxw UIn2zAVzw4xngK9HCB7c1l9iCu8t7bwIoQ== X-Google-Smtp-Source: ABdhPJyPGgaRgYz7P+RRTQmS6y46hHUA44Ek1KOnt3Ob4koyqornOpM9PbtFq3HCveZm0K36G0sD6A== X-Received: by 2002:a05:6000:1ce:: with SMTP id t14mr25583946wrx.85.1617570265326; Sun, 04 Apr 2021 14:04:25 -0700 (PDT) Received: from localhost.localdomain (206.159.69.91.rev.sfr.net. [91.69.159.206]) by smtp.googlemail.com with ESMTPSA id s21sm21169803wmc.10.2021.04.04.14.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Apr 2021 14:04:24 -0700 (PDT) From: Phi-Bang Nguyen To: libcamera-devel@lists.libcamera.org Date: Sun, 4 Apr 2021 23:03:53 +0200 Message-Id: <20210404210353.268967-1-pnguyen@baylibre.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] pipeline: simple: Fix an issue in breadth-first search X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 --- 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 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. */