{"id":13880,"url":"https://patchwork.libcamera.org/api/1.1/patches/13880/?format=json","web_url":"https://patchwork.libcamera.org/patch/13880/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20210921173955.20408-2-vedantparanjape160201@gmail.com>","date":"2021-09-21T17:39:54","name":"[libcamera-devel,v2,2/3] test: gstreamer: Simplify single stream test using functions from GstUtils","commit_ref":"fa9a9d7f6b6452bf8d0fdd5de03512547b84204a","pull_url":null,"state":"accepted","archived":false,"hash":"1988bf0191f11f3e53c746a4b274e0f33975b43c","submitter":{"id":85,"url":"https://patchwork.libcamera.org/api/1.1/people/85/?format=json","name":"Vedant Paranjape","email":"vedantparanjape160201@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13880/mbox/","series":[{"id":2542,"url":"https://patchwork.libcamera.org/api/1.1/series/2542/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2542","date":"2021-09-21T17:39:53","name":"[libcamera-devel,v2,1/3] test: gstreamer_single_stream_test: Fix memory leak","version":2,"mbox":"https://patchwork.libcamera.org/series/2542/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13880/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13880/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 3AE04BF01C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 21 Sep 2021 17:40:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EF7BA6918F;\n\tTue, 21 Sep 2021 19:40:22 +0200 (CEST)","from mail-pf1-x430.google.com (mail-pf1-x430.google.com\n\t[IPv6:2607:f8b0:4864:20::430])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2DAE360247\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Sep 2021 19:40:21 +0200 (CEST)","by mail-pf1-x430.google.com with SMTP id j6so200225pfa.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Sep 2021 10:40:21 -0700 (PDT)","from localhost.localdomain ([1.186.167.167])\n\tby smtp.googlemail.com with ESMTPSA id\n\tk190sm19800772pgc.11.2021.09.21.10.40.16\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 21 Sep 2021 10:40:19 -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=\"HdP6Wh5j\"; 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:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=tb4uXsSEYUVCuLNaLZVZWGtIEeTVTZs1So588/ItGS8=;\n\tb=HdP6Wh5jDsfb7R08nTVTSe4HEl0u/Ya3olPXo9enQ8UOJ6gXI2ev45uPe/LliHB9MU\n\tksKOBfcNm/X2+L1nGLhNkQ/QR+po94gAkk1NhTObW3x/Io/3IYZQFQWMNhE2Iu8ngyWE\n\t8btIO3za939/ZytIZtSNC7gpaKkC65TEAWTOFSIFJD/BDpSXvdKRbqPV632YdmpzODRw\n\t2AbRxUXyvTDHTRBlUNq2fYLyx41rur1TvzVWTr/DpIlOeZ6sSVhOaNna06CBAx2+e7Yb\n\tK2sDSKAJmAxZ8mPENRuoD0ByQIgRymNHn0514bSZMruLOLGWd7ohJl3Pj6qnY/I7NuHR\n\tVBAQ==","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:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=tb4uXsSEYUVCuLNaLZVZWGtIEeTVTZs1So588/ItGS8=;\n\tb=0zNLpFp2qVlnwNDlIqM+gs2WrKI+Fi+35Cy5Hk9UMYIpJeO0kPHz6AeMxKfE5z5NuE\n\tDAYkVKGlvAtHhGqLK4ODE+7H3A1fOU+FmrQNJCI3RcaoabmFXeGdvBIbBbgJGMNWz5Hs\n\tZBZSwElNDLPPYqhF2RVrzLowuA/HiGsm4b1diAm5TVEAyhKN4D7JtAzKuqdEcyZCWmaM\n\tHWczxXbLPh2CCEV3DnUhUF0G/a8c8jkjoAnQ7Mf2M/pj/GdVLf9lVOe8V0LAayekAfIf\n\tSkGEToX/JwjwjyBU1uB33/o6jeQFLn5AjVEIM+eV8l8ilZxpHkawxmGpV9pO1Ro5jxJj\n\tLfyA==","X-Gm-Message-State":"AOAM533PPCpJ9iE1V2asr/1WocaYvIGWBGFFEG4iGhjgD874ZMOnVuA9\n\tkdTvk894Dgxj8ZTXEM3lvMjjrQCITbi5PA==","X-Google-Smtp-Source":"ABdhPJwzns9XmSq/4v95jqJVXmSNdb2T4rFplPfpLnGpABWYBgpPJwgBXxf3rFbfkA5rM+z3jUh2QQ==","X-Received":"by 2002:a63:4464:: with SMTP id t36mr29431811pgk.4.1632246019530;\n\tTue, 21 Sep 2021 10:40:19 -0700 (PDT)","From":"Vedant Paranjape <vedantparanjape160201@gmail.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 21 Sep 2021 23:09:54 +0530","Message-Id":"<20210921173955.20408-2-vedantparanjape160201@gmail.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20210921173955.20408-1-vedantparanjape160201@gmail.com>","References":"<20210921173955.20408-1-vedantparanjape160201@gmail.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 2/3] test: gstreamer: Simplify single\n\tstream test using functions from GstUtils","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>,\n\tVedant Paranjape <vedantparanjape160201@gmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Simplify memory handling and complexity of the test by using\ngst_parse_bin_from_description_full [1].\n\n[1]: https://gstreamer.freedesktop.org/documentation/gstreamer/gstutils.html?gi-language=c#gst_parse_bin_from_description_full\n\nSigned-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\nReviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n---\n .../gstreamer_single_stream_test.cpp          | 32 ++++++++-----------\n 1 file changed, 14 insertions(+), 18 deletions(-)","diff":"diff --git a/test/gstreamer/gstreamer_single_stream_test.cpp b/test/gstreamer/gstreamer_single_stream_test.cpp\nindex 2b561d6bf9f2..bd74ada0e244 100644\n--- a/test/gstreamer/gstreamer_single_stream_test.cpp\n+++ b/test/gstreamer/gstreamer_single_stream_test.cpp\n@@ -33,20 +33,18 @@ protected:\n \t\tif (status_ != TestPass)\n \t\t\treturn status_;\n \n-\t\tg_autoptr(GstElement) convert0 = gst_element_factory_make(\"videoconvert\", \"convert0\");\n-\t\tg_autoptr(GstElement) sink0 = gst_element_factory_make(\"fakesink\", \"sink0\");\n-\t\tg_object_ref_sink(convert0);\n-\t\tg_object_ref_sink(sink0);\n-\n-\t\tif (!convert0 || !sink0) {\n-\t\t\tg_printerr(\"Not all elements could be created. %p.%p\\n\",\n-\t\t\t\t   convert0, sink0);\n-\n+\t\tconst gchar *streamDescription = \"videoconvert ! 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\t\treturn TestFail;\n \t\t}\n-\n-\t\tconvert0_ = reinterpret_cast<GstElement *>(g_steal_pointer(&convert0));\n-\t\tsink0_ = reinterpret_cast<GstElement *>(g_steal_pointer(&sink0));\n+\t\tg_object_ref_sink(stream0_);\n \n \t\tif (createPipeline() != TestPass)\n \t\t\treturn TestFail;\n@@ -57,8 +55,8 @@ protected:\n \tint run() override\n \t{\n \t\t/* Build the pipeline */\n-\t\tgst_bin_add_many(GST_BIN(pipeline_), libcameraSrc_, convert0_, sink0_, NULL);\n-\t\tif (gst_element_link_many(libcameraSrc_, convert0_, sink0_, NULL) != TRUE) {\n+\t\tgst_bin_add_many(GST_BIN(pipeline_), libcameraSrc_, stream0_, NULL);\n+\t\tif (gst_element_link(libcameraSrc_, stream0_) != TRUE) {\n \t\t\tg_printerr(\"Elements could not be linked.\\n\");\n \t\t\treturn TestFail;\n \t\t}\n@@ -74,13 +72,11 @@ protected:\n \n \tvoid cleanup() override\n \t{\n-\t\tg_clear_object(&convert0_);\n-\t\tg_clear_object(&sink0_);\n+\t\tg_clear_object(&stream0_);\n \t}\n \n private:\n-\tGstElement *convert0_;\n-\tGstElement *sink0_;\n+\tGstElement *stream0_;\n };\n \n TEST_REGISTER(GstreamerSingleStreamTest)\n","prefixes":["libcamera-devel","v2","2/3"]}