<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 1 Sep, 2021, 01:59 Nicolas Dufresne, <<a href="mailto:nicolas@ndufresne.ca">nicolas@ndufresne.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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 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" rel="noreferrer">vedantparanjape160201@gmail.com</a>><br>
<br>
For my part, this looks like a good start, we will likely modify and adapt 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" rel="noreferrer">nicolas.dufresne@collabora.com</a>><br>
<br>
p.s. I'm starting a discussion inline about the test design itself, why they<br>
need to 2s instead of stop whenever a success condition is met. But this isn't a<br>
change from the already merged test, so not a blocker for this.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">I was the one who made it timeout at 2s, as without timeout the test kept on running forever, what's the success condition here?</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> ---<br>
> .../gstreamer_single_stream_test.cpp     | 145 +++-------------<br>
> test/gstreamer/gstreamer_test.cpp       | 157 ++++++++++++++++++<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 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 initialization<br>
> -Â Â Â * leak in glib's g_quark_init(). This should ideally be handled 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 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 error");<br>
> +Â Â Â Â Â Â Â if (status_ != TestPass)<br>
> +Â Â Â Â Â Â Â Â Â Â Â return status_;<br>
>Â <br>
> -Â Â Â Â Â Â Â Â Â Â Â return TestFail;<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>
> -Â Â Â Â Â Â Â /*<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>
> -Â Â Â Â Â Â Â GstPlugin *plugin = gst_registry_lookup(registry, "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. %p.%p\n",<br>
> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â convert0__, sink0__);<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>
> -Â Â Â Â Â Â Â Â Â Â Â gst_deinit();<br>
>Â Â Â Â Â Â Â Â Â Â Â Â return TestFail;<br>
>Â Â Â Â Â Â Â Â }<br>
>Â <br>
> -Â Â Â Â Â Â Â /* Create the elements */<br>
> -Â Â Â Â Â Â Â libcameraSrc_ = gst_element_factory_make("libcamerasrc", "libcamera");<br>
> -Â Â Â Â Â Â Â convert0_ = gst_element_factory_make("videoconvert", "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_ || !libcameraSrc_) {<br>
> -Â Â Â Â Â Â Â Â Â Â Â g_printerr("Not all elements could be created. %p.%p.%p.%p\n",<br>
> -Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â pipeline_, convert0_, sink0_, 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 *>(g_steal_pointer(&convert0__));<br>
> +Â Â Â Â Â Â Â sink0_ = reinterpret_cast<GstElement *>(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_, convert0_, sink0_, NULL);<br>
>Â Â Â Â Â Â Â Â if (gst_element_link_many(libcameraSrc_, convert0_, sink0_, NULL) != TRUE) {<br>
> @@ -119,57 +63,16 @@ protected:<br>
>Â Â Â Â Â Â Â Â Â Â Â Â return TestFail;<br>
>Â Â Â Â Â Â Â Â }<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 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 | 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, 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 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 initialization<br>
> +Â Â Â * leak in glib's g_quark_init(). This should ideally be handled 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 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, "libgstlibcamera.so");<br>
> +Â Â Â if (plugin) {<br>
> +Â Â Â Â Â Â Â gst_registry_remove_plugin(registry, plugin);<br>
> +Â Â Â }<br>
> +<br>
> +Â Â Â std::string path = libcamera::utils::libcameraBuildPath() + "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__ = 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__, pipeline_);<br>
> +<br>
> +Â Â Â Â Â Â Â return TestFail;<br>
> +Â Â Â }<br>
> +<br>
> +Â Â Â libcameraSrc_ = reinterpret_cast<GstElement *>(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 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 | 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, 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>
<br>
Isn't it unfortunate design that all test must last 2s ? Just opening 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 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, gstreamer_dep],<br>
>Â Â Â Â Â Â Â Â Â Â Â Â link_with : test_libraries,<br>
>Â Â Â Â Â Â Â Â Â Â Â Â include_directories : test_includes_internal)<br>
<br>
<br>
</blockquote></div></div></div>