<div dir="auto">Hi Paul,<div dir="auto">I don't see the rationale here. I am not fixing the things what Umang mentioned.</div><div dir="auto"><br></div><div dir="auto">I just happen to add it in the commit message. <span class="gmail_chip gmail_plusreply" dir="auto"><a href="mailto:nicolas@ndufresne.ca" style="color:#15c;text-decoration:underline">@Nicolas Dufresne</a></span><span> and <span class="gmail_chip gmail_plusreply" dir="auto"><a href="mailto:jeanmichel.hautbois@ideasonboard.com" style="color:#15c;text-decoration:underline">@Jean-Michel Hautbois</a></span><span> had told me long back to shift to using parse_bin, so this patch addressed the same. I'll remove the mention of Umang's patch, hope it solves the issue.</span></span></div><div dir="auto"><span><span><br></span></span></div><div dir="auto"><span><span>Regards,</span></span></div><div dir="auto">Vedant Paranjape</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 21 Sep, 2021, 15:25 , <<a href="mailto:paul.elder@ideasonboard.com">paul.elder@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Vedant,<br>
<br>
On Wed, Sep 15, 2021 at 08:39:07PM +0530, Vedant Paranjape wrote:<br>
> Simplify memory handling and complexity of the test by using<br>
> gst_parse_bin_from_description_full [1]. It also fixed memory leak reported<br>
> by Umang Jain, described in his fix [2].<br>
<br>
"For further information, see this patch that wasn't merged"<br>
<br>
True, the patch isn't big or difficult to review, but you did squash two<br>
patches that were doing distinct things (though they did have the same<br>
end goal).<br>
<br>
Please split the patches and expand the commit messages (copying what<br>
Umang had is fine; he said so in the original patch series).<br>
<br>
<br>
Paul<br>
<br>
> <br>
> [1] <a href="https://gstreamer.freedesktop.org/documentation/gstreamer/gstutils.html?gi-language=c#gst_parse_bin_from_description_full" rel="noreferrer noreferrer" target="_blank">https://gstreamer.freedesktop.org/documentation/gstreamer/gstutils.html?gi-language=c#gst_parse_bin_from_description_full</a><br>
> [2] <a href="https://patchwork.libcamera.org/patch/13845/" rel="noreferrer noreferrer" target="_blank">https://patchwork.libcamera.org/patch/13845/</a><br>
> <br>
> Signed-off-by: Vedant Paranjape <<a href="mailto:vedantparanjape160201@gmail.com" target="_blank" rel="noreferrer">vedantparanjape160201@gmail.com</a>><br>
> ---<br>
>  .../gstreamer_single_stream_test.cpp          | 29 +++++++++----------<br>
>  1 file changed, 14 insertions(+), 15 deletions(-)<br>
> <br>
> diff --git a/test/gstreamer/gstreamer_single_stream_test.cpp b/test/gstreamer/gstreamer_single_stream_test.cpp<br>
> index 7292f3280617..a20d79109885 100644<br>
> --- a/test/gstreamer/gstreamer_single_stream_test.cpp<br>
> +++ b/test/gstreamer/gstreamer_single_stream_test.cpp<br>
> @@ -33,20 +33,15 @@ protected:<br>
>               if (status_ != TestPass)<br>
>                       return status_;<br>
>  <br>
> -             g_autoptr(GstElement) convert0 = gst_element_factory_make("videoconvert", "convert0");<br>
> -             g_autoptr(GstElement) sink0 = gst_element_factory_make("fakesink", "sink0");<br>
> -             g_object_ref_sink(convert0);<br>
> -             g_object_ref_sink(sink0);<br>
> -<br>
> -             if (!convert0 || !sink0) {<br>
> -                     g_printerr("Not all elements could be created. %p.%p\n",<br>
> -                                convert0, sink0);<br>
> +             const gchar* streamDescription = "queue ! videoconvert ! fakesink";<br>
> +             g_autoptr(GError) error0 = NULL;<br>
> +             stream0_ = gst_parse_bin_from_description_full(streamDescription, TRUE, NULL, GST_PARSE_FLAG_FATAL_ERRORS, &error0);<br>
>  <br>
> +             if (!stream0_) {<br>
> +                     g_printerr("Not all bins could be created. %p\n", stream0_);<br>
>                       return TestFail;<br>
>               }<br>
> -<br>
> -             convert0_ = reinterpret_cast<GstElement *>(g_steal_pointer(&convert0));<br>
> -             sink0_ = reinterpret_cast<GstElement *>(g_steal_pointer(&sink0));<br>
> +             g_object_ref_sink(stream0_);<br>
>  <br>
>               if (createPipeline() != TestPass)<br>
>                       return TestFail;<br>
> @@ -57,8 +52,8 @@ protected:<br>
>       int run() override<br>
>       {<br>
>               /* Build the pipeline */<br>
> -             gst_bin_add_many(GST_BIN(pipeline_), libcameraSrc_, convert0_, sink0_, NULL);<br>
> -             if (gst_element_link_many(libcameraSrc_, convert0_, sink0_, NULL) != TRUE) {<br>
> +             gst_bin_add_many(GST_BIN(pipeline_), libcameraSrc_, stream0_, NULL);<br>
> +             if (gst_element_link(libcameraSrc_, stream0_) != TRUE) {<br>
>                       g_printerr("Elements could not be linked.\n");<br>
>                       return TestFail;<br>
>               }<br>
> @@ -72,9 +67,13 @@ protected:<br>
>               return TestPass;<br>
>       }<br>
>  <br>
> +     void cleanup() override<br>
> +     {<br>
> +             g_clear_object(&stream0_);<br>
> +     }<br>
> +<br>
>  private:<br>
> -     GstElement *convert0_;<br>
> -     GstElement *sink0_;<br>
> +     GstElement *stream0_;<br>
>  };<br>
>  <br>
>  TEST_REGISTER(GstreamerSingleStreamTest)<br>
> -- <br>
> 2.25.1<br>
> <br>
</blockquote></div>