Patch Detail
Show a patch.
GET /api/1.1/patches/13907/?format=api
{ "id": 13907, "url": "https://patchwork.libcamera.org/api/1.1/patches/13907/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13907/", "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": "<20210923110518.1556973-1-vedantparanjape160201@gmail.com>", "date": "2021-09-23T11:05:18", "name": "[libcamera-devel,v1] test: gstreamer: Add a test for gstreamer multi stream", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "27b358a99e5f81924f72726a6cd953883a868bd6", "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/13907/mbox/", "series": [ { "id": 2550, "url": "https://patchwork.libcamera.org/api/1.1/series/2550/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2550", "date": "2021-09-23T11:05:18", "name": "[libcamera-devel,v1] test: gstreamer: Add a test for gstreamer multi stream", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2550/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13907/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13907/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 E336DBF01C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Sep 2021 11:05:38 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 484046918C;\n\tThu, 23 Sep 2021 13:05:38 +0200 (CEST)", "from mail-pf1-x432.google.com (mail-pf1-x432.google.com\n\t[IPv6:2607:f8b0:4864:20::432])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1EDA169189\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Sep 2021 13:05:37 +0200 (CEST)", "by mail-pf1-x432.google.com with SMTP id w19so5351533pfn.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Sep 2021 04:05:37 -0700 (PDT)", "from localhost.localdomain ([1.186.166.66])\n\tby smtp.googlemail.com with ESMTPSA id\n\tw30sm9057607pjj.30.2021.09.23.04.05.32\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 23 Sep 2021 04:05:34 -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=\"C+aNMwvy\"; 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=GNSulH41k6CNGCmQxRveHbDDzr1clW/ordYhprr0Un4=;\n\tb=C+aNMwvyGZHmXLDsweZWMEg+vi7f5UYeKr5y3hpNc2UYgmXPeVXKf7hikgAOaCweJq\n\tinhWH5FJW9kNSjTGr6BUowMI3Ef8EKrlRHDS8Q8XbODP0BX1uGL4ZXGL6kK0CpHEJ7jY\n\tBtzsBNzL/CvWEED4QziEOoLncp4j1CpLis81djcPVKQfyjPTSFjnVgQ/yw+9vKsewbAV\n\tPAjb6Twv+go3OdUOhbWIAebGzgfDyf8euIGkMPGiYP2chhDz0bM0cZG65kjdCpA1xw8z\n\tRGsPh5nyFN21t16eO5Rms7h1il6sBnny1Wnq349vZS7pYwYdifxCVgqCddkKVFTo4EPr\n\t5VaQ==", "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=GNSulH41k6CNGCmQxRveHbDDzr1clW/ordYhprr0Un4=;\n\tb=y1rNvDNVqh9ffutx+u2BewRN6O1nPLIK8HCQ0WLyWY8r4nDJpma+e+KnLFKudlhCTP\n\txP3NHJCJb3ydytyOCRBa+uTdrvu0vlwc7YTRdEg9IwP8C6V/AccBSy78w7cQ4B5JgHzv\n\trllA4c/ProyLUoWqk4FmxT+RyltKQuBAT/3CCUQyuyBrs51WAa6A26s2s6rzGFsj2Wjh\n\txCVjf9ELXbD0WO6T9ZCuzxy14l4njzyLLs79Yi9gCUu6figy6tbxOZe+Mzwrw5fTgLi4\n\tDT0WULXX36tEOXfVgQ1UkPWUhrUu89sO3g1tqlvuiB0wXkN4yEmEVG6CgEcm0S2a3jhN\n\tYQpA==", "X-Gm-Message-State": "AOAM532mD2jMCzAmEWMa39/e0eGu6TxIWyDXyHfLyJp+L7cF0eoG6LTu\n\tzrBnu5HKWWj4X5C1ZPgUWWjh/SqJ17Rnuw==", "X-Google-Smtp-Source": "ABdhPJz+1rOyNMiBCWCdwUKqZwACRKuIEm9A2WmdqmtW/4KAgfk+ydnV0Zp52AR/efAgsT+ajP00pw==", "X-Received": "by 2002:a63:7a45:: with SMTP id j5mr3612861pgn.369.1632395134835;\n\tThu, 23 Sep 2021 04:05:34 -0700 (PDT)", "From": "Vedant Paranjape <vedantparanjape160201@gmail.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 23 Sep 2021 16:35:18 +0530", "Message-Id": "<20210923110518.1556973-1-vedantparanjape160201@gmail.com>", "X-Mailer": "git-send-email 2.25.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v1] 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": "nicolas.dufresne@collabora.com,\n\tVedant 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 raspberrypi pipeline. This was tested on\na Raspberry Pi 4B+.\n\nSigned-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n---\n\nI am unable to run Valgrind on my RPI4B+, please check for memory\nleaks on RPI4B+ as well. I used the following steps to test on amd64\nsystem using the suppression files.\n\n<snip>\ncd libcamera\nwget https://cgit.freedesktop.org/gstreamer/common/plain/gst.supp -P /tmp\nninja -C build test\nvalgrind --leak-check=full --suppressions=/usr/share/glib-2.0/valgrind/glib.supp --suppressions=/tmp/gst.supp ./build/test/gstreamer/single_stream_test\nvalgrind --leak-check=full --suppressions=/usr/share/glib-2.0/valgrind/glib.supp --suppressions=/tmp/gst.supp ./build/test/gstreamer/multi_stream_test\n<snip>\n\nAlso please test this test on IPU3 enabled devices too, as I don't have\naccess to the same.\n\n---\n .../gstreamer/gstreamer_multi_stream_test.cpp | 118 ++++++++++++++++++\n test/gstreamer/meson.build | 1 +\n 2 files changed, 119 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..76cf5a3418a1\n--- /dev/null\n+++ b/test/gstreamer/gstreamer_multi_stream_test.cpp\n@@ -0,0 +1,118 @@\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\tconst gchar *streamDescription = \"queue ! videoconvert ! fakesink\";\n+\t\tg_autoptr(GError) error0 = NULL;\n+\t\tg_autoptr(GError) error1 = NULL;\n+\t\tstream0_ = gst_parse_bin_from_description_full(streamDescription, TRUE, NULL, GST_PARSE_FLAG_FATAL_ERRORS, &error0);\n+\t\tstream1_ = gst_parse_bin_from_description_full(streamDescription, TRUE, NULL, GST_PARSE_FLAG_FATAL_ERRORS, &error1);\n+\n+\t\tif (!stream0_ || !stream1_) {\n+\t\t\tg_printerr(\"Not all bins could be created. %p.%p\\n\",\n+\t\t\t\t\t\tstream0_, stream1_);\n+\t\t\treturn TestFail;\n+\t\t}\n+\t\tg_object_ref_sink(stream0_);\n+\t\tg_object_ref_sink(stream1_);\n+\n+\t\tif (createPipeline() != TestPass)\n+\t\t\treturn TestFail;\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_,\n+\t\t\t\t\t\t\tstream0_, stream1_, NULL);\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+\n+\t\t{\n+\t\t\tg_autoptr(GstPad) queue0_sink_pad = gst_element_get_static_pad(stream0_, \"sink\");\n+\t\t\tg_autoptr(GstPad) queue1_sink_pad = gst_element_get_static_pad(stream1_, \"sink\");\n+\n+\t\t\tif (gst_pad_link(src_pad, queue0_sink_pad) != GST_PAD_LINK_OK\n+\t\t\t\t|| gst_pad_link(request_pad, queue1_sink_pad) != GST_PAD_LINK_OK) {\n+\t\t\t\tg_printerr(\"Pads could not be linked.\\n\");\n+\t\t\t\treturn TestFail;\n+\t\t\t}\n+\t\t}\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+\tvoid cleanup() override\n+\t{\n+\t\tg_clear_object(&stream0_);\n+\t\tg_clear_object(&stream1_);\n+\t}\n+private:\n+\tstd::string cameraName;\n+\tGstElement *stream0_;\n+\tGstElement *stream1_;\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", "v1" ] }