Patch Detail
Show a patch.
GET /api/patches/19564/?format=api
{ "id": 19564, "url": "https://patchwork.libcamera.org/api/patches/19564/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19564/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20240227175336.560009-4-nicolas@ndufresne.ca>", "date": "2024-02-27T17:53:36", "name": "[v1,3/3] test: gstreamer: Test memory lifetime", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "3f298cd62267c0e40f3beebe9280e8cce6be4ea5", "submitter": { "id": 30, "url": "https://patchwork.libcamera.org/api/people/30/?format=api", "name": "Nicolas Dufresne", "email": "nicolas@ndufresne.ca" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19564/mbox/", "series": [ { "id": 4190, "url": "https://patchwork.libcamera.org/api/series/4190/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4190", "date": "2024-02-27T17:53:33", "name": "gstreamer: Fix a crash when memory outlives the pipeline", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4190/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19564/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19564/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 CBC95BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 27 Feb 2024 17:54:04 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A830862875;\n\tTue, 27 Feb 2024 18:54:04 +0100 (CET)", "from madrid.collaboradmins.com (madrid.collaboradmins.com\n\t[IPv6:2a00:1098:ed:100::25])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B75CD62876\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Feb 2024 18:54:02 +0100 (CET)", "from nicolas-tpx395.lan (cola.collaboradmins.com [195.201.22.229])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (4096 bits)\n\tserver-digest SHA256)\n\t(No client certificate requested) (Authenticated sender: nicolas)\n\tby madrid.collaboradmins.com (Postfix) with ESMTPSA id 2670E378000B; \n\tTue, 27 Feb 2024 17:54:02 +0000 (UTC)" ], "From": "Nicolas Dufresne <nicolas@ndufresne.ca>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH v1 3/3] test: gstreamer: Test memory lifetime", "Date": "Tue, 27 Feb 2024 12:53:36 -0500", "Message-ID": "<20240227175336.560009-4-nicolas@ndufresne.ca>", "X-Mailer": "git-send-email 2.43.2", "In-Reply-To": "<20240227175336.560009-1-nicolas@ndufresne.ca>", "References": "<20240227175336.560009-1-nicolas@ndufresne.ca>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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 <nicolas.dufresne@collabora.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\nTest that everything works fine if a buffer outlives the pipeline.\n\nSigned-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n---\n .../gstreamer_memory_lifetime_test.cpp | 75 +++++++++++++++++++\n test/gstreamer/meson.build | 4 +-\n 2 files changed, 78 insertions(+), 1 deletion(-)\n create mode 100644 test/gstreamer/gstreamer_memory_lifetime_test.cpp", "diff": "diff --git a/test/gstreamer/gstreamer_memory_lifetime_test.cpp b/test/gstreamer/gstreamer_memory_lifetime_test.cpp\nnew file mode 100644\nindex 00000000..8842a826\n--- /dev/null\n+++ b/test/gstreamer/gstreamer_memory_lifetime_test.cpp\n@@ -0,0 +1,75 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2021, Vedant Paranjape\n+ *\n+ * gstreamer_single_stream_test.cpp - GStreamer single stream capture test\n+ */\n+\n+#include <iostream>\n+#include <unistd.h>\n+\n+#include <gst/app/app.h>\n+#include <gst/gst.h>\n+\n+#include \"gstreamer_test.h\"\n+#include \"test.h\"\n+\n+using namespace std;\n+\n+class GstreamerMemoryLifetimeTest : public GstreamerTest, public Test\n+{\n+public:\n+\tGstreamerMemoryLifetimeTest()\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\tappsink_ = gst_element_factory_make(\"appsink\", nullptr);\n+\t\tif (!appsink_) {\n+\t\t\tg_printerr(\"Your installation is missing 'appsink'\\n\");\n+\t\t\treturn TestFail;\n+\t\t}\n+\t\tg_object_ref_sink(appsink_);\n+\n+\t\treturn createPipeline();\n+\t}\n+\n+\tint run() override\n+\t{\n+\t\t/* Build the pipeline */\n+\t\tgst_bin_add_many(GST_BIN(pipeline_), libcameraSrc_, appsink_, nullptr);\n+\t\tif (gst_element_link(libcameraSrc_, appsink_) != TRUE) {\n+\t\t\tg_printerr(\"Elements could not be linked.\\n\");\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (startPipeline() != TestPass)\n+\t\t\treturn TestFail;\n+\n+\t\tsample_ = gst_app_sink_try_pull_sample(GST_APP_SINK(appsink_), GST_SECOND * 5);\n+\t\tgst_element_set_state(pipeline_, GST_STATE_NULL);\n+\n+\t\tif (!sample_)\n+\t\t\treturn TestFail;\n+\n+\t\treturn TestPass;\n+\t}\n+\n+\tvoid cleanup() override\n+\t{\n+\t\tg_clear_pointer(&sample_, gst_sample_unref);\n+\t\tg_clear_object(&appsink_);\n+\t}\n+\n+private:\n+\tGstElement *appsink_;\n+\tGstSample *sample_;\n+};\n+\n+TEST_REGISTER(GstreamerMemoryLifetimeTest)\ndiff --git a/test/gstreamer/meson.build b/test/gstreamer/meson.build\nindex f3ba5a23..70609b88 100644\n--- a/test/gstreamer/meson.build\n+++ b/test/gstreamer/meson.build\n@@ -8,12 +8,14 @@ gstreamer_tests = [\n {'name': 'single_stream_test', 'sources': ['gstreamer_single_stream_test.cpp']},\n {'name': 'multi_stream_test', 'sources': ['gstreamer_multi_stream_test.cpp']},\n {'name': 'device_provider_test', 'sources': ['gstreamer_device_provider_test.cpp']},\n+ {'name': 'memory_lifetime_test', 'sources': ['gstreamer_memory_lifetime_test.cpp']},\n ]\n gstreamer_dep = dependency('gstreamer-1.0', required : true)\n+gstapp_dep = dependency('gstreamer-app-1.0', required : true)\n \n foreach test : gstreamer_tests\n exe = executable(test['name'], test['sources'], 'gstreamer_test.cpp',\n- dependencies : [libcamera_private, gstreamer_dep],\n+ dependencies : [libcamera_private, gstreamer_dep, gstapp_dep],\n link_with : test_libraries,\n include_directories : test_includes_internal)\n \n", "prefixes": [ "v1", "3/3" ] }