{"id":3308,"url":"https://patchwork.libcamera.org/api/patches/3308/?format=json","web_url":"https://patchwork.libcamera.org/patch/3308/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200324175643.22382-2-kgupta@es.iitr.ac.in>","date":"2020-03-24T17:56:41","name":"[libcamera-devel,v2,1/3] libcamera: pipeline: Replace resize() with erase() in validate()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"af04a569cad85176c10f72b9400de486ece3f491","submitter":{"id":39,"url":"https://patchwork.libcamera.org/api/people/39/?format=json","name":"Kaaira Gupta","email":"kgupta@es.iitr.ac.in"},"delegate":{"id":11,"url":"https://patchwork.libcamera.org/api/users/11/?format=json","username":"kbingham","first_name":"Kieran","last_name":"Bingham","email":"kieran.bingham@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/3308/mbox/","series":[{"id":771,"url":"https://patchwork.libcamera.org/api/series/771/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=771","date":"2020-03-24T17:56:40","name":"Use StreamFormats in pipelines","version":2,"mbox":"https://patchwork.libcamera.org/series/771/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3308/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3308/checks/","tags":{},"headers":{"Return-Path":"<kgupta@es.iitr.ac.in>","Received":["from mail-pg1-x532.google.com (mail-pg1-x532.google.com\n\t[IPv6:2607:f8b0:4864:20::532])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C010760411\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Mar 2020 18:57:03 +0100 (CET)","by mail-pg1-x532.google.com with SMTP id u12so9399511pgb.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Mar 2020 10:57:03 -0700 (PDT)","from kaaira-HP-Pavilion-Notebook ([103.113.213.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tn22sm2770316pjq.36.2020.03.24.10.57.01\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 24 Mar 2020 10:57:01 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=es-iitr-ac-in.20150623.gappssmtp.com\n\theader.i=@es-iitr-ac-in.20150623.gappssmtp.com header.b=\"QqLMExTc\"; \n\tdkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=MWgywxvMYeI+ipWzmZQk0+GkEWZA5PZuWKJ75SGt2mA=;\n\tb=QqLMExTcWhbLlUZdPLJuZkZeJZ9J5iRMbt+JmosU5L4SXam2LOk5Sxdn9RDtuR/eBr\n\tQLDAd1m0uJ58KZ2o4Hry8wzIFuoqWtf5r4RfwXMh042qrG1RMK/LthaeIuuIWmHWJZub\n\tSWRmxNdl23o+wvXxSqFZaT2mLQPiAQdzycFhl8Psbd5Cbdq7LJIflf6p9PV+yjhp/06W\n\tqaWDb7fb9KyNSyUTIzXwW4ODoU7eyWNXItMGvFRZtg/kWcTFnLrxBBkgqLta9f1PRZgb\n\txqV220+fN6aBNbSSb6wq0K6hvhegl4ym3Nzmv5qkvOZGFfp6qoEQpiJnOxwtJmG7QAQK\n\tbiyg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=MWgywxvMYeI+ipWzmZQk0+GkEWZA5PZuWKJ75SGt2mA=;\n\tb=pgZaTEg0XraCn90u7RfsJrTG4TiVtL+PH81kSrYEQ4wuMhbBnPwtLctMzloqGodzeO\n\t1T3ArTWs76KYTIeL5blOtpD/C/AO4XDBAyDM0KY9Bcskqo1m6jA3mxq3vMsu99iI6D0o\n\tYAGQFHSm9HjqlahosVDboeB+6nXn9xdU7pCwJ9txlE2sMXy6Cl/mf92bWocD71uUiAzI\n\tGrNHmjdB+guUlTr543o1Y37BgM7HKTYBhTTv4NMPHkbKK58a99XOuHJ0Lmi8mr9t7dLQ\n\tZf1n0NczTHOD7uR963t23mJnX1SufEnIqgF2UZ8YGg196FVtsH/psJ3G1gPSUcC/Tz/m\n\ti3mA==","X-Gm-Message-State":"ANhLgQ2b5zL4cVCevmVM7xFffM0UllhCvJVsy1Vs//x0mjGumRY2v19V\n\tq9vQGr9fnSeEP9qEMmrf34PmuQ==","X-Google-Smtp-Source":"ADFU+vtQcTBXstP1pFZiMKUgc0tF7KOWHP5MAjg0Y/fvZ8hecHx4pP3PSnoyd0pfHhXMvxIYz0UPUg==","X-Received":"by 2002:a63:c50f:: with SMTP id\n\tf15mr28778054pgd.88.1585072622123; \n\tTue, 24 Mar 2020 10:57:02 -0700 (PDT)","From":"Kaaira Gupta <kgupta@es.iitr.ac.in>","To":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tHelen Koike <helen.koike@collabora.com>,\n\tVaishali Thakkar <vthakkar@vaishalithakkar.in>","Cc":"Kaaira Gupta <kgupta@es.iitr.ac.in>","Date":"Tue, 24 Mar 2020 23:26:41 +0530","Message-Id":"<20200324175643.22382-2-kgupta@es.iitr.ac.in>","X-Mailer":"git-send-email 2.17.1","In-Reply-To":"<20200324175643.22382-1-kgupta@es.iitr.ac.in>","References":"<20200324175643.22382-1-kgupta@es.iitr.ac.in>","Subject":"[libcamera-devel] [PATCH v2 1/3] libcamera: pipeline: Replace\n\tresize() with erase() in validate()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 24 Mar 2020 17:57:04 -0000"},"content":"Replace .resize() with .erase() in validate() calls in all pipelines,\nbecause resize() calls default constructor StreamConfiguration() when it\ntries to increase the size.\n\nSigned-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp     | 8 ++++++--\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 8 ++++++--\n src/libcamera/pipeline/uvcvideo.cpp      | 8 ++++++--\n src/libcamera/pipeline/vimc.cpp          | 8 ++++++--\n 4 files changed, 24 insertions(+), 8 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 1b44460..36f3990 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -298,9 +298,13 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n \tif (config_.empty())\n \t\treturn Invalid;\n \n-\t/* Cap the number of entries to the available streams. */\n+\t/*\n+\t * Cap the number of entries to the available streams.\n+\t * Use erase() instead of resize() because resize() uses default constructor\n+\t * when it increases config_'s size, which we wish to avoid.\n+\t */\n \tif (config_.size() > 2) {\n-\t\tconfig_.resize(2);\n+\t\tconfig_.erase(config_.begin() + 2, config_.end());\n \t\tstatus = Adjusted;\n \t}\n \ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 2f909ce..04b0ed3 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -447,9 +447,13 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()\n \tif (config_.empty())\n \t\treturn Invalid;\n \n-\t/* Cap the number of entries to the available streams. */\n+\t/*\n+\t * Cap the number of entries to the available streams.\n+\t * Use erase() instead of resize() because resize() uses default constructor\n+\t * when it increases config_'s size, which we wish to avoid.\n+\t */\n \tif (config_.size() > 1) {\n-\t\tconfig_.resize(1);\n+\t\tconfig_.erase(config_.begin() + 1, config_.end());\n \t\tstatus = Adjusted;\n \t}\n \ndiff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex ffbddf2..462eae2 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -97,9 +97,13 @@ CameraConfiguration::Status UVCCameraConfiguration::validate()\n \tif (config_.empty())\n \t\treturn Invalid;\n \n-\t/* Cap the number of entries to the available streams. */\n+\t/*\n+\t * Cap the number of entries to the available streams.\n+\t * Use erase() instead of resize() because resize() uses default constructor\n+\t * when it increases config_'s size, which we wish to avoid.\n+\t */\n \tif (config_.size() > 1) {\n-\t\tconfig_.resize(1);\n+\t\tconfig_.erase(config_.begin() + 1, config_.end());\n \t\tstatus = Adjusted;\n \t}\n \ndiff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex b04a972..4c991ff 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -123,9 +123,13 @@ CameraConfiguration::Status VimcCameraConfiguration::validate()\n \tif (config_.empty())\n \t\treturn Invalid;\n \n-\t/* Cap the number of entries to the available streams. */\n+\t/*\n+\t * Cap the number of entries to the available streams.\n+\t * Use erase() instead of resize() because resize() uses default constructor\n+\t * when it increases config_'s size, which we wish to avoid.\n+\t */\n \tif (config_.size() > 1) {\n-\t\tconfig_.resize(1);\n+\t\tconfig_.erase(config_.begin() + 1, config_.end());\n \t\tstatus = Adjusted;\n \t}\n \n","prefixes":["libcamera-devel","v2","1/3"]}