Patch Detail
Show a patch.
GET /api/1.1/patches/13843/?format=api
{ "id": 13843, "url": "https://patchwork.libcamera.org/api/1.1/patches/13843/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13843/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20210914084622.118939-1-vedantparanjape160201@gmail.com>", "date": "2021-09-14T08:46:22", "name": "[libcamera-devel,v4] test: gstreamer: Add a test for gstreamer multi stream", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "b5f18b37bf9c8f91a172839bccad91e6b41742df", "submitter": { "id": 85, "url": "https://patchwork.libcamera.org/api/1.1/people/85/?format=api", "name": "Vedant Paranjape", "email": "vedantparanjape160201@gmail.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/13843/mbox/", "series": [ { "id": 2527, "url": "https://patchwork.libcamera.org/api/1.1/series/2527/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2527", "date": "2021-09-14T08:46:22", "name": "[libcamera-devel,v4] test: gstreamer: Add a test for gstreamer multi stream", "version": 4, "mbox": "https://patchwork.libcamera.org/series/2527/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13843/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13843/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id A7227BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Sep 2021 08:46:41 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 167A969183;\n\tTue, 14 Sep 2021 10:46:41 +0200 (CEST)", "from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com\n\t[IPv6:2607:f8b0:4864:20::52c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2B30960249\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Sep 2021 10:46:39 +0200 (CEST)", "by mail-pg1-x52c.google.com with SMTP id k24so12058721pgh.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Sep 2021 01:46:39 -0700 (PDT)", "from localhost.localdomain ([1.186.166.254])\n\tby smtp.googlemail.com with ESMTPSA id\n\ta10sm9996018pfg.20.2021.09.14.01.46.35\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 14 Sep 2021 01:46:37 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"kf1anRC+\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=VuQOHLUPC/m0muVZM2YA9YXlyq9USnu8hmK7IvajGjg=;\n\tb=kf1anRC+22u1E1p14StBViSOCxL3itnsictTsTAgNF6MMarzQYsZlzjbBTBTfFI9ze\n\tpjfbRevZBKG/lrLzP63A1NQMAiA0hrlKYeF1ygzkK3cPRxjH5wPeiOQTy9fcvOuibYaP\n\tByoud+DI7NRVn7QpW2lLcq+57C/PDSfTJ1tfLCW67LEm68JQVzn0Y8Hw+yFky2TieV+x\n\tZ/MvmcSnzymY5sZGOxeh16kd1CTtp4w31RqbeDNryPrxg+V7tDp0CeExnbrKXfWud59J\n\tAMQkicQ3WYXR12H6m0pab2BYI+nPOKCKZntoj6NUhg6VccsDlspeDTAT05AsiVQ59sx3\n\tPQdA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=VuQOHLUPC/m0muVZM2YA9YXlyq9USnu8hmK7IvajGjg=;\n\tb=xPGfmTt1lC+gukdNiouCZASROxgIOcL2PHGpsSlGKxfTaolpkPW+LyIs+gkF/UHLu3\n\tvAdjC0MTT3Aa0JQ8MyXkOgHZSeSt35F4S5wN4ujTxey/N3f15fwX8o8x0oQLYPmN3XCM\n\tfNUCXFiYewXOIL3uePwsr08JIHi9uMXcb5GwXCpAfFswqUww8xEhyys+eg6cnK+/uFvK\n\tCAoLBCqnKb+n9dMFBUJhwaTo+bdVz0eQfQhzdnJ9MMOWVi5+KDo6rk7KG7d+l3vtI8T+\n\tQjozuuL4ZGGzo2PjUscIvIghxmoM9gG+5IidIhDKAEN0X12mvqiWttospF3ShTAJFa1y\n\tr1vA==", "X-Gm-Message-State": "AOAM531REJTWNzv0q87aM7S0Gllvp9OH0//dQvHsGtpom8MLjl5jaWWZ\n\tunayfk/Qj/F3iIIZrMTYjvaEp4h3Y6+jUcGH", "X-Google-Smtp-Source": "ABdhPJzHhwbEwrudyLf3pMmnLkZmi0oSqhUu6ddnjZlqUVtCKNCuyOy91BnpBKf2WLg0ijt1pODX8w==", "X-Received": "by 2002:a63:7807:: with SMTP id\n\tt7mr14554838pgc.474.1631609197327; \n\tTue, 14 Sep 2021 01:46:37 -0700 (PDT)", "From": "Vedant Paranjape <vedantparanjape160201@gmail.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 14 Sep 2021 14:16:22 +0530", "Message-Id": "<20210914084622.118939-1-vedantparanjape160201@gmail.com>", "X-Mailer": "git-send-email 2.25.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4] test: gstreamer: Add a test for\n\tgstreamer multi stream", "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>", "Cc": "Vedant Paranjape <vedantparanjape160201@gmail.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "This patch adds a test to test if multi stream using libcamera's\ngstreamer element works.\n\nTest will run only on devices that support multistream output, i.e.,\ndevices that use IPU3 and RPI pipeline. This was tested on a Raspberry\nPi 4B+\n\nSigned-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\nTested-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n .../gstreamer/gstreamer_multi_stream_test.cpp | 138 ++++++++++++++++++\n test/gstreamer/meson.build | 1 +\n 2 files changed, 139 insertions(+)\n create mode 100644 test/gstreamer/gstreamer_multi_stream_test.cpp", "diff": "diff --git a/test/gstreamer/gstreamer_multi_stream_test.cpp b/test/gstreamer/gstreamer_multi_stream_test.cpp\nnew file mode 100644\nindex 000000000000..aea9a1dcb211\n--- /dev/null\n+++ b/test/gstreamer/gstreamer_multi_stream_test.cpp\n@@ -0,0 +1,138 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2021, Vedant Paranjape\n+ *\n+ * gstreamer_multi_stream_test.cpp - GStreamer multi stream capture test\n+ */\n+\n+#include <iostream>\n+#include <unistd.h>\n+\n+#include <libcamera/base/utils.h>\n+\n+#include <libcamera/libcamera.h>\n+\n+#include \"libcamera/internal/source_paths.h\"\n+\n+#include <gst/gst.h>\n+\n+#include \"gstreamer_test.h\"\n+#include \"test.h\"\n+\n+using namespace std;\n+\n+class GstreamerMultiStreamTest : public GstreamerTest, public Test\n+{\n+public:\n+\tGstreamerMultiStreamTest()\n+\t\t: GstreamerTest()\n+\t{\n+\t}\n+\n+protected:\n+\tint init() override\n+\t{\n+\t\tif (status_ != TestPass)\n+\t\t\treturn status_;\n+\n+\t\t/* Check if platform support multistream output */\n+\t\tlibcamera::CameraManager cm;\n+\t\tcm.start();\n+\t\tbool cameraFound = false;\n+\t\tfor (auto &camera : cm.cameras()) {\n+\t\t\tif (camera->streams().size() > 1) {\n+\t\t\t\tcameraName = camera->id();\n+\t\t\t\tcameraFound = true;\n+\t\t\t\tcm.stop();\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (!cameraFound) {\n+\t\t\tcm.stop();\n+\t\t\treturn TestSkip;\n+\t\t}\n+\n+\t\tg_autoptr(GstElement) convert0 = gst_element_factory_make(\"videoconvert\", \"convert0\");\n+\t\tg_autoptr(GstElement) convert1 = gst_element_factory_make(\"videoconvert\", \"convert1\");\n+\t\tg_autoptr(GstElement) sink0 = gst_element_factory_make(\"fakesink\", \"sink0\");\n+\t\tg_autoptr(GstElement) sink1 = gst_element_factory_make(\"fakesink\", \"sink1\");\n+\t\tg_autoptr(GstElement) queue0 = gst_element_factory_make(\"queue\", \"queue0\");\n+\t\tg_autoptr(GstElement) queue1 = gst_element_factory_make(\"queue\", \"queue1\");\n+\t\tg_object_ref_sink(convert0);\n+\t\tg_object_ref_sink(convert1);\n+\t\tg_object_ref_sink(sink0);\n+\t\tg_object_ref_sink(sink1);\n+\t\tg_object_ref_sink(queue0);\n+\t\tg_object_ref_sink(queue1);\n+\n+\t\tif (!convert0 || !convert1 || !sink0 || !sink1 || !queue0 || !queue1) {\n+\t\t\tg_printerr(\"Not all elements could be created. %p.%p.%p.%p.%p.%p\\n\",\n+\t\t\t\t convert0, convert1, sink0, sink1, queue0, queue1);\n+\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (createPipeline() != TestPass)\n+\t\t\treturn TestFail;\n+\n+\t\tconvert0_ = reinterpret_cast<GstElement *>(g_steal_pointer(&convert0));\n+\t\tconvert1_ = reinterpret_cast<GstElement *>(g_steal_pointer(&convert1));\n+\t\tsink0_ = reinterpret_cast<GstElement *>(g_steal_pointer(&sink0));\n+\t\tsink1_ = reinterpret_cast<GstElement *>(g_steal_pointer(&sink1));\n+\t\tqueue0_ = reinterpret_cast<GstElement *>(g_steal_pointer(&queue0));\n+\t\tqueue1_ = reinterpret_cast<GstElement *>(g_steal_pointer(&queue1));\n+\n+\t\treturn TestPass;\n+\t}\n+\n+\tint run() override\n+\t{\n+\t\tg_object_set(libcameraSrc_, \"camera-name\", cameraName.c_str(), NULL);\n+\n+\t\t/* Build the pipeline */\n+\t\tgst_bin_add_many(GST_BIN(pipeline_), libcameraSrc_, queue0_, queue1_,\n+\t\t\t\t convert0_, convert1_, sink0_, sink1_, NULL);\n+\t\tif (gst_element_link_many(queue0_, convert0_, sink0_, NULL) != TRUE ||\n+\t\t gst_element_link_many(queue1_, convert1_, sink1_, NULL) != TRUE) {\n+\t\t\tg_printerr(\"Elements could not be linked.\\n\");\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tg_autoptr(GstPad) src_pad = gst_element_get_static_pad(libcameraSrc_, \"src\");\n+\t\tg_autoptr(GstPad) request_pad = gst_element_get_request_pad(libcameraSrc_, \"src_%u\");\n+\t\tGstPad *queue0_sink_pad = gst_element_get_static_pad(queue0_, \"sink\");\n+\t\tGstPad *queue1_sink_pad = gst_element_get_static_pad(queue1_, \"sink\");\n+\n+\t\tif (gst_pad_link(src_pad, queue0_sink_pad) != GST_PAD_LINK_OK\n+\t\t\t|| gst_pad_link(request_pad, queue1_sink_pad) != GST_PAD_LINK_OK) {\n+\t\t\tif (queue0_sink_pad)\n+\t\t\t\tgst_object_unref(queue0_sink_pad);\n+\t\t\tif (queue1_sink_pad)\n+\t\t\t\tgst_object_unref(queue1_sink_pad);\n+\t\t\tg_printerr(\"Pads could not be linked.\\n\");\n+\t\t\treturn TestFail;\n+\t\t}\n+\t\tgst_object_unref(queue0_sink_pad);\n+\t\tgst_object_unref(queue1_sink_pad);\n+\n+\t\tif (startPipeline() != TestPass)\n+\t\t\treturn TestFail;\n+\n+\t\tif (processEvent() != TestPass)\n+\t\t\treturn TestFail;\n+\n+\t\treturn TestPass;\n+\t}\n+\n+private:\n+\tstd::string cameraName;\n+\tGstElement *convert0_;\n+\tGstElement *convert1_;\n+\tGstElement *sink0_;\n+\tGstElement *sink1_;\n+\tGstElement *queue0_;\n+\tGstElement *queue1_;\n+};\n+\n+TEST_REGISTER(GstreamerMultiStreamTest)\ndiff --git a/test/gstreamer/meson.build b/test/gstreamer/meson.build\nindex aca53b920365..13652e87d05c 100644\n--- a/test/gstreamer/meson.build\n+++ b/test/gstreamer/meson.build\n@@ -6,6 +6,7 @@ endif\n \n gstreamer_tests = [\n ['single_stream_test', 'gstreamer_single_stream_test.cpp'],\n+ ['multi_stream_test', 'gstreamer_multi_stream_test.cpp'],\n ]\n gstreamer_dep = dependency('gstreamer-1.0', required: true)\n \n", "prefixes": [ "libcamera-devel", "v4" ] }