Age | Commit message (Collapse) | Author |
|
Move the logic for checking the availability of cameras from
multi_stream_test to gstreamer test base class. Since
single_stream_class always assumes that a camera is available on the
system (which is not always the case for e.g. RPi in CI/CD environments)
it makes sense to have the availability check in the base class.
If no cameras are available, the behaviour should be to skip instead
of a failure.
We currently have 2 tests for gstreamer differing based on number
of streams supported by the camera. Hence, the camera availability
is checked in conjunction with the number of the streams required by
the derived class.
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The internal header isn't needed. The needed function
libcameraBuildPath() is exposed by libcamera/base/utils.h header.
At the same time, move the utils header to .cpp instead of including
it in the base class header itself.
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
gst_element_get_request_pad() is being replaced by gst_element_request_simple()
since 1.19.1, throwing a warning in case of use until its definitive
replacement on 1.20.
Hence, prefer using gst_element_request_simple() in case gstreamer
version is >= 1.19.1 to avoid the compilation error below (tested on f35):
[258/391] Compiling C++ object test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o
FAILED: test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o
c++ -Itest/gstreamer/multi_stream_test.p -Itest/gstreamer -I../test/gstreamer -Itest/libtest -I../test/libtest -Iinclude -I../include -Iinclude/libcamera/ipa -Iinclude/libcamera -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Werror -std=c++17 -g -Wshadow -include config.h -pthread -DLIBCAMERA_BASE_PRIVATE -MD -MQ test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o -MF test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o.d -o test/gstreamer/multi_stream_test.p/gstreamer_multi_stream_test.cpp.o -c ../test/gstreamer/gstreamer_multi_stream_test.cpp
../test/gstreamer/gstreamer_multi_stream_test.cpp: In member function ‘virtual int GstreamerMultiStreamTest::run()’:
../test/gstreamer/gstreamer_multi_stream_test.cpp:90:76: error: ‘GstPad* gst_element_get_request_pad(GstElement*, const gchar*)’ is deprecated: Use 'gst_element_request_pad_simple' instead [-Werror=deprecated-declarations]
90 | g_autoptr(GstPad) request_pad = gst_element_get_request_pad(libcameraSrc_, "src_%u");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/gstreamer-1.0/gst/gstbin.h:27,
from /usr/include/gstreamer-1.0/gst/gst.h:35,
from ../test/gstreamer/gstreamer_multi_stream_test.cpp:13:
/usr/include/gstreamer-1.0/gst/gstelement.h:1042:25: note: declared here
1042 | GstPad* gst_element_get_request_pad (GstElement *element, const gchar *name);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Remove the verbose #ifndef/#define/#endif pattern for maintaining
header idempotency, and replace it with a simple #pragma once.
This simplifies the headers, and prevents redundant changes when
header files get moved.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
|
|
"using namespace" in a header file propagates the namespace to
the files including the header file. So it should be avoided.
This removes "using namespace" in header files in test.
Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Remove header files which were not being used in the test code.
The following headers were removed from the gstreamer_single_stream_test:
- libcamera/base/utils.h
- libcamera/internal/source_paths.h
Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
|
|
This patch adds a test to test if multi stream using libcamera's
gstreamer element works.
Test will run only on devices that support multistream capture, eg.,
devices that use IPU3 and raspberrypi pipeline. This was tested on
a Raspberry Pi 4B+.
Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
In gstreamer, when elements are created, usually a floating [1]
reference is returned which simply means, there is no ownership
transfer (yet). Once can simply check for NULL and return through
an error path, without bothering to clean up. Hence, g_autoptr is
not much of help here.
If the NULL checks have been passed successfully, elements are ready
to use. However, we must claim ownership/reference it before using
them via g_object_ref_sink().
This patch build upon this principle and removes the g_autoptr
from gstreamer test base class (gstreamer_test.cpp) whereever
necessary to tide up the code.
[1] https://gstreamer.freedesktop.org/documentation/additional/design/MT-refcounting.html?gi-language=c#refcounting1
Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
Simplify memory handling and complexity of the test by using
gst_parse_bin_from_description_full [1].
[1]: https://gstreamer.freedesktop.org/documentation/gstreamer/gstutils.html?gi-language=c#gst_parse_bin_from_description_full
Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
The test hold a valid reference to convert0_ and sink0_ but
not released. This results in a memory leak and can be checked
via valgrind. Drop the references with test cleanup() virtual
function.
Valgrind log (glib and gst suppression files were used):
==345380== LEAK SUMMARY:
==345380== definitely lost: 1,688 bytes in 2 blocks
==345380== indirectly lost: 7,069 bytes in 42 blocks
The patch fixes the leaks reported by valgrind above to:
==348870== LEAK SUMMARY:
==348870== definitely lost: 0 bytes in 0 blocks
==348870== indirectly lost: 0 bytes in 0 blocks
Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
The destructor tried to check if pipeline_ is a parent of libcameraSrc_.
This was needed to be checked as if it is, cleanup of libcameraSrc_
would be handled by pipeline itself.
Since, the destructor can be called anytime, even when pipeline_ hasn't
been created, the use of pipeline_ to check if libcameraSrc_ has an
ancestor as pipeline_ caused a segmentation fault.
Fixes: f58768092277 ("test: gstreamer: Fix the destructor of GstreamerTest base class")
Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
A lot of code used in the single stream test is boiler plate and common
across every gstreamer test. Factor out this code into a base class
called GstreamerTest.
Also update the gstreamer_single_stream_test to use the GstreamerTest
base class.
Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
ASan needs to be loaded first before gstreamer is loaded. This was not
possible, so verify_asan_link_order was disabled. Better way to tackle
this issue was disabling forks on the gstreamer side.
verify_asan_link_order=0 disables the check on ASan side which checks if
ASan was loaded before any other shared objects. Since, gstreamer spawns
a child helper process while building the registry, we needed to disable
this check. But with gst_registry_fork_set_enabled() it is possible to
disable spawning this child helper process, so this ensures that ASan is
loaded before any other shared object is loaded.
Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
This patch simplifies memory management, i.e., by replacing bare
pointers with g_autoptr or g_autofree according to use case.
While at it also update time representation of timeout variable with
GST_SECOND.
Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
This patch adds a test to test if single stream using libcamera's
gstreamer element works.
We need to work around two distinct issues with ASan when enabled in the
build:
- glib has a known leak at initialization time. This is covered by the
suppression file shipped with glib, but it's not clear how to use it
automatically. For now, disable leak detection to avoid test failures.
- GStreamer spawns a child process to scan plugins. If GStreamer is
compiled without ASan (which is likely) but libcamera is, dlopen()ing
the libcamera plugin will cause an ASan link order verification
failure. Disable the verification child processes to work around the
problem. This requires gcc 8 or newer.
Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|