<div dir="auto">Hi Laurent,<div dir="auto">These patches are stale. I have sent a new patch series replacing this please take a look at it.</div><div dir="auto"><br></div><div dir="auto">Even though your comments do apply there too.</div><div dir="auto"><br></div><div dir="auto">Regards,</div><div dir="auto">Vedant Paranjape</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 21 Sep, 2021, 22:47 Laurent Pinchart, <<a href="mailto:laurent.pinchart@ideasonboard.com">laurent.pinchart@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>
Thank you for the patch.<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>
> [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>
<br>
There's a queue introduced here that isn't mentioned in the commit<br>
message. Why is it needed ?<br>
<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>
That's a very long line. Wrapping at 80 columns wouldn't be very<br>
practical here, but<br>
<br>
                stream0_ = gst_parse_bin_from_description_full(streamDescription, TRUE, NULL,<br>
                                                               GST_PARSE_FLAG_FATAL_ERRORS,<br>
                                                               &error0);<br>
would already be more readable I think.<br>
<br>
>  <br>
> +             if (!stream0_) {<br>
> +                     g_printerr("Not all bins could be created. %p\n", stream0_);<br>
<br>
Given that stream0_ is null here, why do you print it ? Can error0 be<br>
printed instead somehow (not as a %p I suppose) ?<br>
<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>
-- <br>
Regards,<br>
<br>
Laurent Pinchart<br>
</blockquote></div>