{"id":19634,"url":"https://patchwork.libcamera.org/api/patches/19634/?format=json","web_url":"https://patchwork.libcamera.org/patch/19634/","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":"<20240305153058.1761020-3-nicolas@ndufresne.ca>","date":"2024-03-05T15:30:57","name":"[v2,2/3] test: gstreamer: Simplify single stream test","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"0afc00f7f0076fd84152b5073c5d72ee11d8b1c0","submitter":{"id":30,"url":"https://patchwork.libcamera.org/api/people/30/?format=json","name":"Nicolas Dufresne","email":"nicolas@ndufresne.ca"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19634/mbox/","series":[{"id":4203,"url":"https://patchwork.libcamera.org/api/series/4203/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4203","date":"2024-03-05T15:30:55","name":"gstreamer: Fix a crash when memory outlives the pipeline","version":2,"mbox":"https://patchwork.libcamera.org/series/4203/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19634/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19634/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 B66B2BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  5 Mar 2024 15:31:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 46DBC62874;\n\tTue,  5 Mar 2024 16:31:13 +0100 (CET)","from madrid.collaboradmins.com (madrid.collaboradmins.com\n\t[46.235.227.194])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D129C62871\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Mar 2024 16:31:09 +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 346B0378149B; \n\tTue,  5 Mar 2024 15:31:09 +0000 (UTC)"],"From":"Nicolas Dufresne <nicolas@ndufresne.ca>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH v2 2/3] test: gstreamer: Simplify single stream test","Date":"Tue,  5 Mar 2024 10:30:57 -0500","Message-ID":"<20240305153058.1761020-3-nicolas@ndufresne.ca>","X-Mailer":"git-send-email 2.43.2","In-Reply-To":"<20240305153058.1761020-1-nicolas@ndufresne.ca>","References":"<20240305153058.1761020-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\nSigned-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n---\n .../gstreamer_single_stream_test.cpp          | 27 +++++++------------\n 1 file changed, 9 insertions(+), 18 deletions(-)","diff":"diff --git a/test/gstreamer/gstreamer_single_stream_test.cpp b/test/gstreamer/gstreamer_single_stream_test.cpp\nindex 301e4a93..815c6609 100644\n--- a/test/gstreamer/gstreamer_single_stream_test.cpp\n+++ b/test/gstreamer/gstreamer_single_stream_test.cpp\n@@ -29,30 +29,21 @@ protected:\n \t\tif (status_ != TestPass)\n \t\t\treturn status_;\n \n-\t\tconst gchar *streamDescription = \"fakesink\";\n-\t\tg_autoptr(GError) error0 = NULL;\n-\t\tstream0_ = gst_parse_bin_from_description_full(streamDescription, TRUE,\n-\t\t\t\t\t\tNULL,\n-\t\t\t\t\t\tGST_PARSE_FLAG_FATAL_ERRORS,\n-\t\t\t\t\t\t&error0);\n-\n-\t\tif (!stream0_) {\n-\t\t\tg_printerr(\"Bin could not be created (%s)\\n\", error0->message);\n+\t\tfakesink_ = gst_element_factory_make(\"fakesink\", nullptr);\n+\t\tif (!fakesink_) {\n+\t\t\tg_printerr(\"Your installation is missing 'fakesink'\\n\");\n \t\t\treturn TestFail;\n \t\t}\n-\t\tg_object_ref_sink(stream0_);\n-\n-\t\tif (createPipeline() != TestPass)\n-\t\t\treturn TestFail;\n+\t\tg_object_ref_sink(fakesink_);\n \n-\t\treturn TestPass;\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_, stream0_, NULL);\n-\t\tif (gst_element_link(libcameraSrc_, stream0_) != TRUE) {\n+\t\tgst_bin_add_many(GST_BIN(pipeline_), libcameraSrc_, fakesink_, nullptr);\n+\t\tif (!gst_element_link(libcameraSrc_, fakesink_)) {\n \t\t\tg_printerr(\"Elements could not be linked.\\n\");\n \t\t\treturn TestFail;\n \t\t}\n@@ -68,11 +59,11 @@ protected:\n \n \tvoid cleanup() override\n \t{\n-\t\tg_clear_object(&stream0_);\n+\t\tg_clear_object(&fakesink_);\n \t}\n \n private:\n-\tGstElement *stream0_;\n+\tGstElement *fakesink_;\n };\n \n TEST_REGISTER(GstreamerSingleStreamTest)\n","prefixes":["v2","2/3"]}