[{"id":954,"web_url":"https://patchwork.libcamera.org/comment/954/","msgid":"<20190228171709.GA7811@pendragon.ideasonboard.com>","date":"2019-02-28T17:17:09","subject":"Re: [libcamera-devel] [PATCH v2 4/4] libcamera: camera: ensure\n\tstreams belong to camera","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Thu, Feb 28, 2019 at 03:16:26AM +0100, Niklas Söderlund wrote:\n> Before calling into the pipeline handler make sure the streams provided\n> by the application actually belongs to the camera.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/libcamera/camera.cpp | 10 ++++++++++\n>  1 file changed, 10 insertions(+)\n> \n> diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\n> index 4f0833300b9b7ffc..52992e577b6ab011 100644\n> --- a/src/libcamera/camera.cpp\n> +++ b/src/libcamera/camera.cpp\n> @@ -337,6 +337,11 @@ Camera::streamConfiguration(std::set<Stream *> &streams)\n>  \tif (disconnected_ || !streams.size())\n>  \t\treturn std::map<Stream *, StreamConfiguration>{};\n>  \n> +\tfor (Stream *stream : streams) {\n> +\t\tif (streams_.find(stream) == streams_.end())\n> +\t\t\treturn std::map<Stream *, StreamConfiguration>{};\n> +\t}\n> +\n>  \treturn pipe_->streamConfiguration(this, streams);\n>  }\n>  \n> @@ -378,6 +383,11 @@ int Camera::configureStreams(std::map<Stream *, StreamConfiguration> &config)\n>  \t\treturn -EINVAL;\n>  \t}\n>  \n> +\tfor (auto const &iter : config) {\n> +\t\tif (streams_.find(iter.first) == streams_.end())\n> +\t\t\treturn -EINVAL;\n> +\t}\n> +\n>  \tret = pipe_->configureStreams(this, config);\n>  \tif (ret)\n>  \t\treturn ret;\n\nThe patch itself is fine, so\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nbut before you apply it, is it really worth it ?","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 82917610B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Feb 2019 18:17:23 +0100 (CET)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AB35B49;\n\tThu, 28 Feb 2019 18:17:22 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1551374242;\n\tbh=2ekm4H+Wt8WVfvownO7Vi5NzQEsafGM2ZSgbjW1TQu8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=qD7HEMkgh+ECvQNAPDtGMgmG+Xf0/0ISSn2xO5oTh6hs1nR0BT77WVJN1guDnn4T6\n\tMncTtBJq9rOJHLCNVL2XK9a53YYt9OL8cGWGVBoCrmCKmWWuu9b1yAnEA2XkYtNTHf\n\ti5clMvGUl3vScBzJMjLu4qE3ad4Btjg5ByT35MsI=","Date":"Thu, 28 Feb 2019 19:17:09 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190228171709.GA7811@pendragon.ideasonboard.com>","References":"<20190228021626.15062-1-niklas.soderlund@ragnatech.se>\n\t<20190228021626.15062-5-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190228021626.15062-5-niklas.soderlund@ragnatech.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 4/4] libcamera: camera: ensure\n\tstreams belong to camera","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Thu, 28 Feb 2019 17:17:23 -0000"}},{"id":965,"web_url":"https://patchwork.libcamera.org/comment/965/","msgid":"<20190228184314.GM899@bigcity.dyn.berto.se>","date":"2019-02-28T18:43:14","subject":"Re: [libcamera-devel] [PATCH v2 4/4] libcamera: camera: ensure\n\tstreams belong to camera","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your feedback.\n\nOn 2019-02-28 19:17:09 +0200, Laurent Pinchart wrote:\n> Hi Niklas,\n> \n> Thank you for the patch.\n> \n> On Thu, Feb 28, 2019 at 03:16:26AM +0100, Niklas Söderlund wrote:\n> > Before calling into the pipeline handler make sure the streams provided\n> > by the application actually belongs to the camera.\n> > \n> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > ---\n> >  src/libcamera/camera.cpp | 10 ++++++++++\n> >  1 file changed, 10 insertions(+)\n> > \n> > diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\n> > index 4f0833300b9b7ffc..52992e577b6ab011 100644\n> > --- a/src/libcamera/camera.cpp\n> > +++ b/src/libcamera/camera.cpp\n> > @@ -337,6 +337,11 @@ Camera::streamConfiguration(std::set<Stream *> &streams)\n> >  \tif (disconnected_ || !streams.size())\n> >  \t\treturn std::map<Stream *, StreamConfiguration>{};\n> >  \n> > +\tfor (Stream *stream : streams) {\n> > +\t\tif (streams_.find(stream) == streams_.end())\n> > +\t\t\treturn std::map<Stream *, StreamConfiguration>{};\n> > +\t}\n> > +\n> >  \treturn pipe_->streamConfiguration(this, streams);\n> >  }\n> >  \n> > @@ -378,6 +383,11 @@ int Camera::configureStreams(std::map<Stream *, StreamConfiguration> &config)\n> >  \t\treturn -EINVAL;\n> >  \t}\n> >  \n> > +\tfor (auto const &iter : config) {\n> > +\t\tif (streams_.find(iter.first) == streams_.end())\n> > +\t\t\treturn -EINVAL;\n> > +\t}\n> > +\n> >  \tret = pipe_->configureStreams(this, config);\n> >  \tif (ret)\n> >  \t\treturn ret;\n> \n> The patch itself is fine, so\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> but before you apply it, is it really worth it ?\n\nI think it is, but we can discuss this further as it's not critical to \nadd the state machine. I will drop this patch from next version and post \nit separately if we decide it's worth it.\n\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x242.google.com (mail-lj1-x242.google.com\n\t[IPv6:2a00:1450:4864:20::242])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6C560610B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Feb 2019 19:43:16 +0100 (CET)","by mail-lj1-x242.google.com with SMTP id z7so17891881lji.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Feb 2019 10:43:16 -0800 (PST)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\ts3sm1429249lji.94.2019.02.28.10.43.15\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tThu, 28 Feb 2019 10:43:15 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=GL/WQSFIyCaIN1YyQY7OrMa+kTbA281xx5WngsxTDf0=;\n\tb=N6ANdS7auS6MOjm1y33UAPFcXiFFjYKPbOh/hz/JWTzGHiDU0DHtdB5tsERga/2l+Z\n\tuN5cgzZSGuZu35lMeneW/ae89swi2oUtr6f7ds2NBCryHWjPZv2I/73Nz7w8gRfMIy79\n\tPLFgwCf27us0hUJdEogpV9Qwzme7lmd1XFvZs+mQbUqvcQH0bLzOzSnLne+A5IIXFLJw\n\tGMqZ2toxZt/XhZbo473Xg16ABti9QFckJ4xcM91yjKQFtf3sjmO0QvPNXlYmWtpK4Xfq\n\tVE2XzWebCMpX7YFvMON8EdmboqK5NkmAG+M4TjLU51FKbP8qmetRmDZyCPuJ5GG/9S9h\n\t7X7w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=GL/WQSFIyCaIN1YyQY7OrMa+kTbA281xx5WngsxTDf0=;\n\tb=tg64AA8+RzE0inWnjlbNNasdgcwDPuAclKHst6ecd5ld8tBhv6wm9gfjKap5jQnYlW\n\tRCf0bKUOueNTlAAYz/5zgsYInziUnkhJoa7SB7PbrPro5UPRWnSnESUsSRKSJoyaJFWV\n\tziindOURhfUwgPWkuPETuxpRq+uuF6B1ZhrSKK9dLMBncTShxmEpXX6l6BSeb0TGrhno\n\t81leSjU1Nfe9YEEyHr1thvF9Iu4YbZTHOY2hyKMzlCj7HEuPUTk7vVULHr6I+qbC0wSh\n\tv/eH4d/gmR2mSAlu1lNIq2X4p1RycaOu65MFq8Czz43mkp0VOBZUUybYWnxBH32i1abV\n\t6ANQ==","X-Gm-Message-State":"APjAAAXZjlUk/rJD2/a7W6LTK0yAsHn4MJi9zJ1tbz5qEzouvpt6A9XK\n\tiOVN9CoN/vQOV6EQGOA4Lshrlg==","X-Google-Smtp-Source":"APXvYqwbGE/3zEXeyGpPCg/psU+KLs96KSnasjYZO7OkH+T67pYu44VBSeQP1M/OQrkZr0qvKOmMBQ==","X-Received":"by 2002:a2e:2c0d:: with SMTP id s13mr254630ljs.96.1551379395758; \n\tThu, 28 Feb 2019 10:43:15 -0800 (PST)","Date":"Thu, 28 Feb 2019 19:43:14 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190228184314.GM899@bigcity.dyn.berto.se>","References":"<20190228021626.15062-1-niklas.soderlund@ragnatech.se>\n\t<20190228021626.15062-5-niklas.soderlund@ragnatech.se>\n\t<20190228171709.GA7811@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190228171709.GA7811@pendragon.ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 4/4] libcamera: camera: ensure\n\tstreams belong to camera","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Thu, 28 Feb 2019 18:43:16 -0000"}},{"id":1018,"web_url":"https://patchwork.libcamera.org/comment/1018/","msgid":"<20190305213845.GF9239@bigcity.dyn.berto.se>","date":"2019-03-05T21:38:45","subject":"Re: [libcamera-devel] [PATCH v2 4/4] libcamera: camera: ensure\n\tstreams belong to camera","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi, \n\nOn 2019-02-28 19:43:14 +0100, Niklas Söderlund wrote:\n> On 2019-02-28 19:17:09 +0200, Laurent Pinchart wrote:\n\n[snip]\n\n> > \n> > but before you apply it, is it really worth it ?\n> \n> I think it is, but we can discuss this further as it's not critical to \n> add the state machine. I will drop this patch from next version and post \n> it separately if we decide it's worth it.\n\nAs discussed on IRC we see value in this change and I have pushed it \nwith Jacopo's and Laurent's tag, thanks!","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x244.google.com (mail-lj1-x244.google.com\n\t[IPv6:2a00:1450:4864:20::244])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 96C71600FC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Mar 2019 22:38:47 +0100 (CET)","by mail-lj1-x244.google.com with SMTP id z25so8944309ljk.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 05 Mar 2019 13:38:47 -0800 (PST)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tf19sm2378948lfk.69.2019.03.05.13.38.46\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 05 Mar 2019 13:38:46 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=H68EiN4hFvTwUJpsamR0bDNDtCbLVCLNnURpOpYpIn4=;\n\tb=Obl5uPke2I7PN3MYSwCQdk77lkZxsT34gGlE2ypt57TWUylNh5CCK3G5xB5p5eVdyV\n\t8DE2XA53pukJ4kHfgLpPvxbUyNQEiWjFM2cJDtdcPtewTBezeu+8m/z2twGadnFGSINq\n\tM2GaMfmPACcrjCGqS3N9ExdZCWmWgDc541mZo4avu6QEOlJxI0rfyTzartrAPaQMm9qc\n\tq6WYCWL5C5NkafISCmJ96xU5Op176Tjp1bPxlBa/LUyp7KNm4TkRjWMcDx1jrhHgEdlW\n\tmKeKhYHsZX0ohlWofVKQASDr3DKczrT1YkA+A0OKSAQUqG1adh82o0TbSwU6d5h9vNpw\n\tAQng==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=H68EiN4hFvTwUJpsamR0bDNDtCbLVCLNnURpOpYpIn4=;\n\tb=l4GXo0OA03JxmENZ4HYNnrsJM9VdVVXltUp6YPDGJVjDy7IZ50IqKsE0XAWRYhJZQH\n\tFY46F08139xJbeBCFE9liONahpRxw7x4e4Ole94BwI49yQO8qEiFIqY7hsEfgLx72YkQ\n\tnNuyhFaZCz2O0Gj/tJkiHe4+3i3yhNf1Sh8xh1XgWy7cYkGPRk5d2Se48IDjrN04kTvx\n\t4SxFv6p50L+7PmjtzyC/jGpdhPSKgv6W8eb6JxfYTowzMT1xgy5B1C9N5tl8swkwiNJo\n\tQ83cz0EzzLvMW5CiwVrcty8kBC3lq3BaUpwfP8C4yE1qdwihu5q68mTkmrtIfFkiKVRJ\n\tb9HQ==","X-Gm-Message-State":"APjAAAVR29SGbCokpktQVSyKsTxcB5mzhLvOl2oVfRMnTsJEbLWZxR/g\n\tteZ3wDnhM/hMSiw+vHuHgcGGlQBwyfE=","X-Google-Smtp-Source":"APXvYqxpO7fJgHs20GgDSpT1qwnYWSGNas1ZlkZuwp7G1O9jVki0LacfOsXmJw4jfWOL7B24dFD3Gw==","X-Received":"by 2002:a2e:995a:: with SMTP id r26mr429941ljj.3.1551821926790; \n\tTue, 05 Mar 2019 13:38:46 -0800 (PST)","Date":"Tue, 5 Mar 2019 22:38:45 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190305213845.GF9239@bigcity.dyn.berto.se>","References":"<20190228021626.15062-1-niklas.soderlund@ragnatech.se>\n\t<20190228021626.15062-5-niklas.soderlund@ragnatech.se>\n\t<20190228171709.GA7811@pendragon.ideasonboard.com>\n\t<20190228184314.GM899@bigcity.dyn.berto.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190228184314.GM899@bigcity.dyn.berto.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 4/4] libcamera: camera: ensure\n\tstreams belong to camera","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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, 05 Mar 2019 21:38:47 -0000"}}]