Commit graph

11 commits

Author SHA1 Message Date
Nicolas Dufresne
0c9862d6e3 gstreamer: allocator: Ensure camera manager stay alive
Without the camera manager, it is not possible to cleanly delete the
FrameBufferAllocator object. Keep the camera manager alive until all the
memory object have been released.

A shared_ptr to the CameraManager is introduced which is itself stored
as a plain pointer and allocated and released explicitly. When more
than one C++ member is required, this can be refactored to use a new C++
class, but the struct _GstLibcameraAllocator is allocated and freed by
glib, so it does not have automatic destruction presently.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=211
[Kieran: Update test framework to remove expected test fail]
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25 11:44:32 +01:00
Nicolas Dufresne
d267fd6d89 test: gstreamer: Test memory lifetime
Test that everything works fine if a buffer outlives the pipeline.

[Kieran: Update test path with comments and clarify test case]
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25 11:44:05 +01:00
Laurent Pinchart
6fc5f90f16 test: gstreamer: Include missing sanitizer/asan_interface.h header
The GStreamer tests define a __asan_default_options() function to
influence the behaviour of ASan. The function is declared in
sanitizer/asan_interface.h, but we don't include the header. This will
cause missing declaration warnings when we enable the
-Wmissing-declarations option.

Include the header to fix the issue. It can't be done unconditionally as
not all toolchains provide ASan, so check for its availability at
configuration time.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-26 12:07:11 +03:00
Nicolas Dufresne
484c86ac65 test: gstreamer: Use env instead of registry edit
Instead of editing the registry, use gst_env variable provided by the plugin and
already used as part of the devenv shell. This reduces the complexity of the
C++ test code.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-23 02:21:39 +02:00
Laurent Pinchart
ca437b4a0c meson: Fix space around colon issues
The meson style, which libcamera follows, recommends a space before
colons in function parameters. Fix the style violations through the
project.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2023-07-07 11:39:19 +03:00
Umang Jain
adb1bbb748 tests: gstreamer: Test cameras' enumeration from GstDeviceProvider
Test the enumeration of the cameras through GstDeviceProvider against
the libcamera camera manager.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
2023-07-06 10:05:27 +02:00
Laurent Pinchart
8abcce31ee test: meson: Use dictionaries instead of arrays to store test information
Tests are listed in meson.build using arrays that contain the test name
and source files at fixed positions. This isn't very readable, leading
to code using test[0], test[1] and test[2]. Replace the arrays with
dictionaries to improve readability.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-10-07 17:05:42 +03:00
Laurent Pinchart
2ee8faf3c8 test: Rename 't' to 'test' in meson.build
The 't' name is very short and not very explicit. Rename it to 'test'
instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-10-07 17:05:33 +03:00
Vedant Paranjape
d1713de60a test: gstreamer: Add a test for gstreamer multi stream
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>
2021-09-24 18:01:15 +09:00
Vedant Paranjape
39c2d5dc95 test: gstreamer: Factor out code into a base class
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>
2021-09-08 17:40:53 +09:00
Vedant Paranjape
25462474f8 test: gstreamer: Add test for gstreamer single stream
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>
2021-08-14 22:58:46 +03:00