{"id":13856,"url":"https://patchwork.libcamera.org/api/patches/13856/?format=json","web_url":"https://patchwork.libcamera.org/patch/13856/","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":"<20210915150907.736222-1-vedantparanjape160201@gmail.com>","date":"2021-09-15T15:09:07","name":"[libcamera-devel,v1] test: gstreamer: Simplify single stream test using functions from GstUtils","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"8eaa4e71d1d74cfa232df8db72eb5f509c4d5d4e","submitter":{"id":85,"url":"https://patchwork.libcamera.org/api/people/85/?format=json","name":"Vedant Paranjape","email":"vedantparanjape160201@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13856/mbox/","series":[{"id":2533,"url":"https://patchwork.libcamera.org/api/series/2533/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2533","date":"2021-09-15T15:09:07","name":"[libcamera-devel,v1] test: gstreamer: Simplify single stream test using functions from GstUtils","version":1,"mbox":"https://patchwork.libcamera.org/series/2533/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13856/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13856/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 48439BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Sep 2021 15:09:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 82AE360248;\n\tWed, 15 Sep 2021 17:09:30 +0200 (CEST)","from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com\n\t[IPv6:2607:f8b0:4864:20::102b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E2B0560131\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Sep 2021 17:09:28 +0200 (CEST)","by mail-pj1-x102b.google.com with SMTP id\n\tnn5-20020a17090b38c500b0019af1c4b31fso2436196pjb.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Sep 2021 08:09:28 -0700 (PDT)","from localhost.localdomain ([1.186.165.222])\n\tby smtp.googlemail.com with ESMTPSA id\n\tt10sm318099pge.10.2021.09.15.08.09.24\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 15 Sep 2021 08:09:26 -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=\"bsp7Vimr\"; 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=T2qpSI1hlPWaYj+u2t173bDLVJ7aOw6f9jaTZhe3Ss4=;\n\tb=bsp7VimrYhIeGKzSZiXHLeFwVYQYWKojzZDroSu8abYR96Mb96rh2b70lcFFJCCYZD\n\tZEYjmcNjm1BXxt12VMmmSqwCca6P4LhFCSPo5l0/2GjcGD1DNHgrKGwJz9uHda7KVuws\n\tsWkZIAjJdz0grQ4VSEnevUps/WuL2ezFAJUiwiQQeX0MIhIi2vEfaN8Hc3mIgav94xR8\n\tgQmcaUjxyg6u1vioCxXURKaGupk8xsDj5Xdl5T/pIei2r3Q5lzFSTtLPJkORTn9oFlBS\n\tdYzSF1Uz90zguTl7hoMUEZ7MRcm1xoxLL/2xYUlqxewpCRutl1372Lwx9Ut3dq6m8A90\n\ttkOw==","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=T2qpSI1hlPWaYj+u2t173bDLVJ7aOw6f9jaTZhe3Ss4=;\n\tb=21fm8n62FLcM59X7dD+MhOSrTcBh4UE7045nBzeE8yhxLWpEW+IMbn0tbKaPy7Dxo+\n\tPHfQSYFwsasfYyMwUm6cn8xKXj0YET6sNv9YhNr4F3DOfpnX1z3VOr0tZnz4KY2Kyr9+\n\tni2pjzWf9LUw+tb/+wotfxGUvzmTgmtAUE1gD4UgrFpZVxWCNbpPyrUC8CnPhssg0snk\n\t5hODEvxLmjU1xQ6apSWKQS5LEWMSimqCO8H697W5zLjeOAqdOftLlL5nlzdjI//fXQv2\n\tUVmAmjZuR35w8E9ZjCD4strlcs4Ny0y16G+HSpEcbRDGnstqwdolfPKoKL9odK8N1C/P\n\tGGPQ==","X-Gm-Message-State":"AOAM530iff4c441lQnP9yxj3S1UQ5RGimj4CiTrMj4ZFCj0R1BmpH1GT\n\tnE00XUEI44KZqE+FeE3FEdwQFHp6Wx4vrQ==","X-Google-Smtp-Source":"ABdhPJyfL26aRpf5kvRN22Es2F0SBY3gUk6WHhXgdBREoRYrs9CrtYqCLdyScswEnTXgm3qMrjYE2g==","X-Received":"by 2002:a17:90b:17c1:: with SMTP id\n\tme1mr9306466pjb.28.1631718566985; \n\tWed, 15 Sep 2021 08:09:26 -0700 (PDT)","From":"Vedant Paranjape <vedantparanjape160201@gmail.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 15 Sep 2021 20:39:07 +0530","Message-Id":"<20210915150907.736222-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: 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":"Vedant 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]. It also fixed memory leak reported\nby Umang Jain, described in his fix [2].\n\n[1] https://gstreamer.freedesktop.org/documentation/gstreamer/gstutils.html?gi-language=c#gst_parse_bin_from_description_full\n[2] https://patchwork.libcamera.org/patch/13845/\n\nSigned-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n---\n .../gstreamer_single_stream_test.cpp          | 29 +++++++++----------\n 1 file changed, 14 insertions(+), 15 deletions(-)","diff":"diff --git a/test/gstreamer/gstreamer_single_stream_test.cpp b/test/gstreamer/gstreamer_single_stream_test.cpp\nindex 7292f3280617..a20d79109885 100644\n--- a/test/gstreamer/gstreamer_single_stream_test.cpp\n+++ b/test/gstreamer/gstreamer_single_stream_test.cpp\n@@ -33,20 +33,15 @@ 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+\t\tconst gchar* streamDescription = \"queue ! videoconvert ! fakesink\";\n+\t\tg_autoptr(GError) error0 = NULL;\n+\t\tstream0_ = gst_parse_bin_from_description_full(streamDescription, TRUE, NULL, GST_PARSE_FLAG_FATAL_ERRORS, &error0);\n \n+\t\tif (!stream0_) {\n+\t\t\tg_printerr(\"Not all bins could be created. %p\\n\", stream0_);\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 +52,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@@ -72,9 +67,13 @@ protected:\n \t\treturn TestPass;\n \t}\n \n+\tvoid cleanup() override\n+\t{\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","v1"]}