<div dir="ltr">Got it, thanks! <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 1, 2021 at 9:24 PM Nicolas Dufresne <<a href="mailto:nicolas@ndufresne.ca">nicolas@ndufresne.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Le mercredi 01 septembre 2021 à 02:13 +0530, Vedant Paranjape a écrit :<br>
> <br>
> <br>
> On Wed, 1 Sep, 2021, 02:11 Nicolas Dufresne, <<a href="mailto:nicolas@ndufresne.ca" target="_blank">nicolas@ndufresne.ca</a>> wrote:<br>
> > Le mercredi 01 septembre 2021 à 02:04 +0530, Vedant Paranjape a écrit :<br>
> > > <br>
> > > <br>
> > > On Wed, 1 Sep, 2021, 01:59 Nicolas Dufresne, <<a href="mailto:nicolas@ndufresne.ca" target="_blank">nicolas@ndufresne.ca</a>> wrote:<br>
> > > > Le mercredi 01 septembre 2021 à 01:32 +0530, Vedant Paranjape a écrit :<br>
> > > > > Lot of code used in single stream test is boiler plate and common<br>
> > > > > across<br>
> > > > > every gstreamer test. Factored out this code into a base class called<br>
> > > > > GstreamerTest.<br>
> > > > > <br>
> > > > > Also updated the gstreamer_single_stream_test to use the GstreamerTest<br>
> > > > > base class<br>
> > > > > <br>
> > > > > Signed-off-by: Vedant Paranjape <<a href="mailto:vedantparanjape160201@gmail.com" target="_blank">vedantparanjape160201@gmail.com</a>><br>
> > > > <br>
> > > > For my part, this looks like a good start, we will likely modify and<br>
> > > > adapt<br>
> > > > test<br>
> > > > while adding few more and it will get more stable later.<br>
> > > > <br>
> > > > Reviewed-by: Nicolas Dufresne <<a href="mailto:nicolas.dufresne@collabora.com" target="_blank">nicolas.dufresne@collabora.com</a>><br>
> > > > <br>
> > > > p.s. I'm starting a discussion inline about the test design itself, why<br>
> > they<br>
> > > > need to 2s instead of stop whenever a success condition is met. But this<br>
> > > > isn't<br>
> > > > a<br>
> > > > change from the already merged test, so not a blocker for this.<br>
> > > <br>
> > > I was the one who made it timeout at 2s, as without timeout the test kept<br>
> > > on<br>
> > > running forever, what's the success condition here?<br>
> > <br>
> > This is just a test run, I'd use pad probe, and after couple of non-zero<br>
> > frames,<br>
> > I'd stop and quit. This can be done with a GMainLoop, using<br>
> > g_main_loop_quit(),<br>
> > or using an application message, that get catched as success in your<br>
> > process_event() function.<br>
> > <br>
> > The second way is thinner I believe.<br>
> <br>
> What benefits do these method have over the way I did it?<br>
<br>
Consider long term, with growing number of test, if all tests take 2s to run,<br>
and run one after the other, running the test will be very very long.<br>
<br>
With a test that only runs the time requires to figure-out if the camera is<br>
spitting non-fully black images, only few ms are needed.<br>
<br>
> <br>
> > > <br>
> > > > > ---<br>
> > > > >   .../gstreamer_single_stream_test.cpp          | 145 +++-------------<br>
> > > > >   test/gstreamer/gstreamer_test.cpp             | 157<br>
> > > > > ++++++++++++++++++<br>
> > > > >   test/gstreamer/gstreamer_test.h               |  39 +++++<br>
> > > > >   test/gstreamer/meson.build                    |   2 +-<br>
> > > > >   4 files changed, 221 insertions(+), 122 deletions(-)<br>
> > > > >   create mode 100644 test/gstreamer/gstreamer_test.cpp<br>
> > > > >   create mode 100644 test/gstreamer/gstreamer_test.h<br>
> > > > > <br>
> > > > > diff --git a/test/gstreamer/gstreamer_single_stream_test.cpp<br>
> > > > b/test/gstreamer/gstreamer_single_stream_test.cpp<br>
> > > > > index 4c8d4804..c27e4d36 100644<br>
> > > > > --- a/test/gstreamer/gstreamer_single_stream_test.cpp<br>
> > > > > +++ b/test/gstreamer/gstreamer_single_stream_test.cpp<br>
> > > > > @@ -14,104 +14,48 @@<br>
> > > > >   <br>
> > > > >   #include <gst/gst.h><br>
> > > > >   <br>
> > > > > +#include "gstreamer_test.h"<br>
> > > > >   #include "test.h"<br>
> > > > >   <br>
> > > > >   using namespace std;<br>
> > > > >   <br>
> > > > > -extern "C" {<br>
> > > > > -const char *__asan_default_options()<br>
> > > > > -{<br>
> > > > > -     /*<br>
> > > > > -      * Disable leak detection due to a known global variable<br>
> > > > initialization<br>
> > > > > -      * leak in glib's g_quark_init(). This should ideally be handled<br>
> > by<br>
> > > > > -      * using a suppression file instead of disabling leak detection.<br>
> > > > > -      */<br>
> > > > > -     return "detect_leaks=false";<br>
> > > > > -}<br>
> > > > > -}<br>
> > > > > -<br>
> > > > > -class GstreamerSingleStreamTest : public Test<br>
> > > > > +class GstreamerSingleStreamTest : public GstreamerTest, public Test<br>
> > > > >   {<br>
> > > > > +public:<br>
> > > > > +     GstreamerSingleStreamTest()<br>
> > > > > +             : GstreamerTest()<br>
> > > > > +     {<br>
> > > > > +     }<br>
> > > > > +<br>
> > > > >   protected:<br>
> > > > >        int init() override<br>
> > > > >        {<br>
> > > > > -             /*<br>
> > > > > -              * GStreamer by default spawns a process to run the<br>
> > > > > -              * gst-plugin-scanner helper. If libcamera is compiled<br>
> > with<br>
> > > > ASan<br>
> > > > > -              * enabled, and as GStreamer is most likely not, this<br>
> > causes<br>
> > > > the<br>
> > > > > -              * ASan link order check to fail when gst-plugin-scanner<br>
> > > > > -              * dlopen()s the plugin as many libraries will have<br>
> > already<br>
> > > > been<br>
> > > > > -              * loaded by then. Fix this issue by disabling spawning<br>
> > > > > of<br>
> > a<br>
> > > > > -              * child helper process when scanning the build<br>
> > > > > directory<br>
> > > > > for<br>
> > > > > -              * plugins.<br>
> > > > > -              */<br>
> > > > > -             gst_registry_fork_set_enabled(false);<br>
> > > > > -<br>
> > > > > -             /* Initialize GStreamer */<br>
> > > > > -             g_autoptr(GError) errInit = NULL;<br>
> > > > > -             if (!gst_init_check(nullptr, nullptr, &errInit)) {<br>
> > > > > -                     g_printerr("Could not initialize GStreamer:<br>
> > > > > %s\n",<br>
> > > > > -                                errInit ? errInit->message : "unknown<br>
> > > > error");<br>
> > > > > +             if (status_ != TestPass)<br>
> > > > > +                     return status_;<br>
> > > > >   <br>
> > > > > -                     return TestFail;<br>
> > > > > -             }<br>
> > > > > +             g_autoptr(GstElement) convert0__ =<br>
> > > > gst_element_factory_make("videoconvert", "convert0");<br>
> > > > > +             g_autoptr(GstElement) sink0__ =<br>
> > > > gst_element_factory_make("fakesink", "sink0");<br>
> > > > > +             g_object_ref_sink(convert0__);<br>
> > > > > +             g_object_ref_sink(sink0__);<br>
> > > > >   <br>
> > > > > -             /*<br>
> > > > > -              * Remove the system libcamera plugin, if any, and add<br>
> > > > > the<br>
> > > > > -              * plugin from the build directory.<br>
> > > > > -              */<br>
> > > > > -             GstRegistry *registry = gst_registry_get();<br>
> > > > > -             GstPlugin *plugin = gst_registry_lookup(registry,<br>
> > > > "libgstlibcamera.so");<br>
> > > > > -             if (plugin) {<br>
> > > > > -                     gst_registry_remove_plugin(registry, plugin);<br>
> > > > > -                     gst_object_unref(plugin);<br>
> > > > > -             }<br>
> > > > > +             if (!convert0__ || !sink0__) {<br>
> > > > > +                     g_printerr("Not all elements could be created.<br>
> > > > %p.%p\n",<br>
> > > > > +                                convert0__, sink0__);<br>
> > > > >   <br>
> > > > > -             std::string path =<br>
> > > > > libcamera::utils::libcameraBuildPath()<br>
> > > > > -                              + "src/gstreamer";<br>
> > > > > -             if (!gst_registry_scan_path(registry, path.c_str())) {<br>
> > > > > -                     g_printerr("Failed to add plugin to<br>
> > > > > registry\n");<br>
> > > > > -                     gst_deinit();<br>
> > > > >                        return TestFail;<br>
> > > > >                }<br>
> > > > >   <br>
> > > > > -             /* Create the elements */<br>
> > > > > -             libcameraSrc_ = gst_element_factory_make("libcamerasrc",<br>
> > > > "libcamera");<br>
> > > > > -             convert0_ = gst_element_factory_make("videoconvert",<br>
> > > > "convert0");<br>
> > > > > -             sink0_ = gst_element_factory_make("fakesink", "sink0");<br>
> > > > > -<br>
> > > > > -             /* Create the empty pipeline_ */<br>
> > > > > -             pipeline_ = gst_pipeline_new("test-pipeline");<br>
> > > > > -<br>
> > > > > -             if (!pipeline_ || !convert0_ || !sink0_ ||<br>
> > > > > !libcameraSrc_)<br>
> > {<br>
> > > > > -                     g_printerr("Not all elements could be created.<br>
> > > > %p.%p.%p.%p\n",<br>
> > > > > -                                pipeline_, convert0_, sink0_,<br>
> > > > libcameraSrc_);<br>
> > > > > -                     if (pipeline_)<br>
> > > > > -                             gst_object_unref(pipeline_);<br>
> > > > > -                     if (convert0_)<br>
> > > > > -                             gst_object_unref(convert0_);<br>
> > > > > -                     if (sink0_)<br>
> > > > > -                             gst_object_unref(sink0_);<br>
> > > > > -                     if (libcameraSrc_)<br>
> > > > > -                             gst_object_unref(libcameraSrc_);<br>
> > > > > -                     gst_deinit();<br>
> > > > > +             convert0_ = reinterpret_cast<GstElement<br>
> > > > *>(g_steal_pointer(&convert0__));<br>
> > > > > +             sink0_ = reinterpret_cast<GstElement<br>
> > > > *>(g_steal_pointer(&sink0__));<br>
> > > > >   <br>
> > > > > +             if (gstreamer_create_pipeline() != TestPass)<br>
> > > > >                        return TestFail;<br>
> > > > > -             }<br>
> > > > >   <br>
> > > > >                return TestPass;<br>
> > > > >        }<br>
> > > > >   <br>
> > > > > -     void cleanup() override<br>
> > > > > -     {<br>
> > > > > -             gst_object_unref(pipeline_);<br>
> > > > > -             gst_deinit();<br>
> > > > > -     }<br>
> > > > > -<br>
> > > > >        int run() override<br>
> > > > >        {<br>
> > > > > -             GstStateChangeReturn ret;<br>
> > > > > -<br>
> > > > >                /* Build the pipeline */<br>
> > > > >                gst_bin_add_many(GST_BIN(pipeline_), libcameraSrc_,<br>
> > > > > convert0_,<br>
> > > > sink0_, NULL);<br>
> > > > >                if (gst_element_link_many(libcameraSrc_, convert0_,<br>
> > sink0_,<br>
> > > > NULL) != TRUE) {<br>
> > > > > @@ -119,57 +63,16 @@ protected:<br>
> > > > >                        return TestFail;<br>
> > > > >                }<br>
> > > > >   <br>
> > > > > -             /* Start playing */<br>
> > > > > -             ret = gst_element_set_state(pipeline_,<br>
> > > > > GST_STATE_PLAYING);<br>
> > > > > -             if (ret == GST_STATE_CHANGE_FAILURE) {<br>
> > > > > -                     g_printerr("Unable to set the pipeline to the<br>
> > > > > playing<br>
> > > > state.\n");<br>
> > > > > +             if (gstreamer_start_pipeline() != TestPass)<br>
> > > > >                        return TestFail;<br>
> > > > > -             }<br>
> > > > >   <br>
> > > > > -             /* Wait until error or EOS or timeout after 2 seconds */<br>
> > > > > -             constexpr GstMessageType msgType =<br>
> > > > > -                     static_cast<GstMessageType>(GST_MESSAGE_ERROR |<br>
> > > > GST_MESSAGE_EOS);<br>
> > > > > -             constexpr GstClockTime timeout = 2 * GST_SECOND;<br>
> > > > > -<br>
> > > > > -             g_autoptr(GstBus) bus = gst_element_get_bus(pipeline_);<br>
> > > > > -             g_autoptr(GstMessage) msg =<br>
> > gst_bus_timed_pop_filtered(bus,<br>
> > > > timeout, msgType);<br>
> > > > > -<br>
> > > > > -             gst_element_set_state(pipeline_, GST_STATE_NULL);<br>
> > > > > -<br>
> > > > > -             /* Parse error message */<br>
> > > > > -             if (msg == NULL)<br>
> > > > > -                     return TestPass;<br>
> > > > > -<br>
> > > > > -             switch (GST_MESSAGE_TYPE(msg)) {<br>
> > > > > -             case GST_MESSAGE_ERROR:<br>
> > > > > -                     gstreamer_print_error(msg);<br>
> > > > > -                     break;<br>
> > > > > -             case GST_MESSAGE_EOS:<br>
> > > > > -                     g_print("End-Of-Stream reached.\n");<br>
> > > > > -                     break;<br>
> > > > > -             default:<br>
> > > > > -                     g_printerr("Unexpected message received.\n");<br>
> > > > > -                     break;<br>
> > > > > -             }<br>
> > > > > +             if (gstreamer_process_event() != TestPass)<br>
> > > > > +                     return TestFail;<br>
> > > > >   <br>
> > > > > -             return TestFail;<br>
> > > > > +             return TestPass;<br>
> > > > >        }<br>
> > > > >   <br>
> > > > >   private:<br>
> > > > > -     void gstreamer_print_error(GstMessage *msg)<br>
> > > > > -     {<br>
> > > > > -             g_autoptr(GError) err = NULL;<br>
> > > > > -             g_autofree gchar *debug_info = NULL;<br>
> > > > > -<br>
> > > > > -             gst_message_parse_error(msg, &err, &debug_info);<br>
> > > > > -             g_printerr("Error received from element %s: %s\n",<br>
> > > > > -                        GST_OBJECT_NAME(msg->src), err->message);<br>
> > > > > -             g_printerr("Debugging information: %s\n",<br>
> > > > > -                        debug_info ? debug_info : "none");<br>
> > > > > -     }<br>
> > > > > -<br>
> > > > > -     GstElement *pipeline_;<br>
> > > > > -     GstElement *libcameraSrc_;<br>
> > > > >        GstElement *convert0_;<br>
> > > > >        GstElement *sink0_;<br>
> > > > >   };<br>
> > > > > diff --git a/test/gstreamer/gstreamer_test.cpp<br>
> > > > b/test/gstreamer/gstreamer_test.cpp<br>
> > > > > new file mode 100644<br>
> > > > > index 00000000..22128c4c<br>
> > > > > --- /dev/null<br>
> > > > > +++ b/test/gstreamer/gstreamer_test.cpp<br>
> > > > > @@ -0,0 +1,157 @@<br>
> > > > > +/* SPDX-License-Identifier: GPL-2.0-or-later */<br>
> > > > > +/*<br>
> > > > > + * Copyright (C) 2021, Vedant Paranjape<br>
> > > > > + *<br>
> > > > > + * libcamera Gstreamer element API tests<br>
> > > > > + */<br>
> > > > > +<br>
> > > > > +#include "gstreamer_test.h"<br>
> > > > > +<br>
> > > > > +#include "test.h"<br>
> > > > > +<br>
> > > > > +using namespace std;<br>
> > > > > +<br>
> > > > > +extern "C" {<br>
> > > > > +const char *__asan_default_options()<br>
> > > > > +{<br>
> > > > > +     /*<br>
> > > > > +      * Disable leak detection due to a known global variable<br>
> > > > initialization<br>
> > > > > +      * leak in glib's g_quark_init(). This should ideally be handled<br>
> > by<br>
> > > > > +      * using a suppression file instead of disabling leak detection.<br>
> > > > > +      */<br>
> > > > > +     return "detect_leaks=false";<br>
> > > > > +}<br>
> > > > > +}<br>
> > > > > +<br>
> > > > > +GstreamerTest::GstreamerTest()<br>
> > > > > +{<br>
> > > > > +     /*<br>
> > > > > +     * GStreamer by default spawns a process to run the<br>
> > > > > +     * gst-plugin-scanner helper. If libcamera is compiled with ASan<br>
> > > > > +     * enabled, and as GStreamer is most likely not, this causes the<br>
> > > > > +     * ASan link order check to fail when gst-plugin-scanner<br>
> > > > > +     * dlopen()s the plugin as many libraries will have already been<br>
> > > > > +     * loaded by then. Fix this issue by disabling spawning of a<br>
> > > > > +     * child helper process when scanning the build directory for<br>
> > > > > +     * plugins.<br>
> > > > > +     */<br>
> > > > > +     gst_registry_fork_set_enabled(false);<br>
> > > > > +<br>
> > > > > +     /* Initialize GStreamer */<br>
> > > > > +     g_autoptr(GError) errInit = NULL;<br>
> > > > > +     if (!gst_init_check(nullptr, nullptr, &errInit)) {<br>
> > > > > +             g_printerr("Could not initialize GStreamer: %s\n",<br>
> > > > > +                        errInit ? errInit->message : "unknown<br>
> > > > > error");<br>
> > > > > +<br>
> > > > > +             status_ = TestFail;<br>
> > > > > +             return;<br>
> > > > > +     }<br>
> > > > > +<br>
> > > > > +     /*<br>
> > > > > +     * Remove the system libcamera plugin, if any, and add the<br>
> > > > > +     * plugin from the build directory.<br>
> > > > > +     */<br>
> > > > > +     GstRegistry *registry = gst_registry_get();<br>
> > > > > +     g_autoptr(GstPlugin) plugin = gst_registry_lookup(registry,<br>
> > > > "libgstlibcamera.so");<br>
> > > > > +     if (plugin) {<br>
> > > > > +             gst_registry_remove_plugin(registry, plugin);<br>
> > > > > +     }<br>
> > > > > +<br>
> > > > > +     std::string path = libcamera::utils::libcameraBuildPath() +<br>
> > > > "src/gstreamer";<br>
> > > > > +     if (!gst_registry_scan_path(registry, path.c_str())) {<br>
> > > > > +             g_printerr("Failed to add plugin to registry\n");<br>
> > > > > +<br>
> > > > > +             status_ = TestFail;<br>
> > > > > +             return;<br>
> > > > > +     }<br>
> > > > > +<br>
> > > > > +     status_ = TestPass;<br>
> > > > > +}<br>
> > > > > +<br>
> > > > > +GstreamerTest::~GstreamerTest()<br>
> > > > > +{<br>
> > > > > +     if (pipeline_)<br>
> > > > > +             gst_object_unref(pipeline_);<br>
> > > > > +     if (status_ == TestFail) {<br>
> > > > > +             gst_object_unref(libcameraSrc_);<br>
> > > > > +     }<br>
> > > > > +<br>
> > > > > +     gst_deinit();<br>
> > > > > +}<br>
> > > > > +<br>
> > > > > +int GstreamerTest::gstreamer_create_pipeline()<br>
> > > > > +{<br>
> > > > > +     g_autoptr(GstElement) libcameraSrc__ =<br>
> > > > gst_element_factory_make("libcamerasrc", "libcamera");<br>
> > > > > +     pipeline_ = gst_pipeline_new("test-pipeline");<br>
> > > > > +     g_object_ref_sink(libcameraSrc__);<br>
> > > > > +<br>
> > > > > +     if (!libcameraSrc__ || !pipeline_) {<br>
> > > > > +             g_printerr("Unable to create create pipeline %p.%p\n",<br>
> > > > > +                                             libcameraSrc__,<br>
> > pipeline_);<br>
> > > > > +<br>
> > > > > +             return TestFail;<br>
> > > > > +     }<br>
> > > > > +<br>
> > > > > +     libcameraSrc_ = reinterpret_cast<GstElement<br>
> > > > *>(g_steal_pointer(&libcameraSrc__));<br>
> > > > > +<br>
> > > > > +     return TestPass;<br>
> > > > > +}<br>
> > > > > +<br>
> > > > > +int GstreamerTest::gstreamer_start_pipeline()<br>
> > > > > +{<br>
> > > > > +     GstStateChangeReturn ret;<br>
> > > > > +<br>
> > > > > +     /* Start playing */<br>
> > > > > +     ret = gst_element_set_state(pipeline_, GST_STATE_PLAYING);<br>
> > > > > +     if (ret == GST_STATE_CHANGE_FAILURE) {<br>
> > > > > +             g_printerr("Unable to set the pipeline to the playing<br>
> > > > state.\n");<br>
> > > > > +             return TestFail;<br>
> > > > > +     }<br>
> > > > > +<br>
> > > > > +     return TestPass;<br>
> > > > > +}<br>
> > > > > +<br>
> > > > > +int GstreamerTest::gstreamer_process_event()<br>
> > > > > +{<br>
> > > > > +     /* Wait until error or EOS or timeout after 2 seconds */<br>
> > > > > +     constexpr GstMessageType msgType =<br>
> > > > > +             static_cast<GstMessageType>(GST_MESSAGE_ERROR |<br>
> > > > GST_MESSAGE_EOS);<br>
> > > > > +     constexpr GstClockTime timeout = 2 * GST_SECOND;<br>
> > > > > +<br>
> > > > > +     g_autoptr(GstBus) bus = gst_element_get_bus(pipeline_);<br>
> > > > > +     g_autoptr(GstMessage) msg = gst_bus_timed_pop_filtered(bus,<br>
> > timeout,<br>
> > > > msgType);<br>
> > > > > +<br>
> > > > > +     gst_element_set_state(pipeline_, GST_STATE_NULL);<br>
> > > > > +<br>
> > > > > +     /* Parse error message */<br>
> > > > > +     if (msg == NULL) {<br>
> > > > > +             return TestPass;<br>
> > > > > +     }<br>
> > > > <br>
> > > > Isn't it unfortunate design that all test must last 2s ? Just opening<br>
> > > > the<br>
> > > > discussion, this was like this before.<br>
> > > > <br>
> > > > > +<br>
> > > > > +     switch (GST_MESSAGE_TYPE(msg)) {<br>
> > > > > +     case GST_MESSAGE_ERROR:<br>
> > > > > +             gstreamer_print_error(msg);<br>
> > > > > +             break;<br>
> > > > > +     case GST_MESSAGE_EOS:<br>
> > > > > +             g_print("End-Of-Stream reached.\n");<br>
> > > > > +             break;<br>
> > > > > +     default:<br>
> > > > > +             g_printerr("Unexpected message received.\n");<br>
> > > > > +             break;<br>
> > > > > +     }<br>
> > > > > +<br>
> > > > > +     return TestFail;<br>
> > > > > +}<br>
> > > > > +<br>
> > > > > +void GstreamerTest::gstreamer_print_error(GstMessage *msg)<br>
> > > > > +{<br>
> > > > > +     g_autoptr(GError) err = NULL;<br>
> > > > > +     g_autofree gchar *debug_info = NULL;<br>
> > > > > +<br>
> > > > > +     gst_message_parse_error(msg, &err, &debug_info);<br>
> > > > > +     g_printerr("Error received from element %s: %s\n",<br>
> > > > > +                GST_OBJECT_NAME(msg->src), err->message);<br>
> > > > > +     g_printerr("Debugging information: %s\n",<br>
> > > > > +                debug_info ? debug_info : "none");<br>
> > > > > +}<br>
> > > > > +<br>
> > > > > diff --git a/test/gstreamer/gstreamer_test.h<br>
> > > > b/test/gstreamer/gstreamer_test.h<br>
> > > > > new file mode 100644<br>
> > > > > index 00000000..cdffdea9<br>
> > > > > --- /dev/null<br>
> > > > > +++ b/test/gstreamer/gstreamer_test.h<br>
> > > > > @@ -0,0 +1,39 @@<br>
> > > > > +/* SPDX-License-Identifier: GPL-2.0-or-later */<br>
> > > > > +/*<br>
> > > > > + * Copyright (C) 2021, Vedant Paranjape<br>
> > > > > + *<br>
> > > > > + * gstreamer_test.cpp - GStreamer test base class<br>
> > > > > + */<br>
> > > > > +<br>
> > > > > +#ifndef __LIBCAMERA_GSTREAMER_TEST_H__<br>
> > > > > +#define __LIBCAMERA_GSTREAMER_TEST_H__<br>
> > > > > +<br>
> > > > > +#include <iostream><br>
> > > > > +#include <unistd.h><br>
> > > > > +<br>
> > > > > +#include <libcamera/base/utils.h><br>
> > > > > +<br>
> > > > > +#include "libcamera/internal/source_paths.h"<br>
> > > > > +<br>
> > > > > +#include <gst/gst.h><br>
> > > > > +<br>
> > > > > +using namespace std;<br>
> > > > > +<br>
> > > > > +class GstreamerTest<br>
> > > > > +{<br>
> > > > > +public:<br>
> > > > > +     GstreamerTest();<br>
> > > > > +     virtual ~GstreamerTest();<br>
> > > > > +<br>
> > > > > +protected:<br>
> > > > > +     virtual int gstreamer_create_pipeline();<br>
> > > > > +     int gstreamer_start_pipeline();<br>
> > > > > +     int gstreamer_process_event();<br>
> > > > > +     void gstreamer_print_error(GstMessage *msg);<br>
> > > > > +<br>
> > > > > +     GstElement *pipeline_;<br>
> > > > > +     GstElement *libcameraSrc_;<br>
> > > > > +     int status_;<br>
> > > > > +};<br>
> > > > > +<br>
> > > > > +#endif /* __LIBCAMERA_GSTREAMER_TEST_H__ */<br>
> > > > > diff --git a/test/gstreamer/meson.build b/test/gstreamer/meson.build<br>
> > > > > index b99aa0da..aca53b92 100644<br>
> > > > > --- a/test/gstreamer/meson.build<br>
> > > > > +++ b/test/gstreamer/meson.build<br>
> > > > > @@ -10,7 +10,7 @@ gstreamer_tests = [<br>
> > > > >   gstreamer_dep = dependency('gstreamer-1.0', required: true)<br>
> > > > >   <br>
> > > > >   foreach t : gstreamer_tests<br>
> > > > > -    exe = executable(t[0], t[1],<br>
> > > > > +    exe = executable(t[0], t[1], 'gstreamer_test.cpp',<br>
> > > > >                        dependencies : [libcamera_private,<br>
> > gstreamer_dep],<br>
> > > > >                        link_with : test_libraries,<br>
> > > > >                        include_directories : test_includes_internal)<br>
> > > > <br>
> > > > <br>
> > <br>
> > <br>
<br>
<br>
</blockquote></div>