Commit graph

4 commits

Author SHA1 Message Date
Umang Jain
1b80d9e997 test: gstreamer: Drop internal header from base class
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>
2022-07-24 19:39:14 +05:30
Vedant Paranjape
c7daf645d4 test: gstreamer: Simplify elements' ownerships
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>
2021-09-23 16:03:15 +09:00
Vedant Paranjape
0eea207b04 test: gstreamer: Fix the destructor of GstreamerTest base class
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>
2021-09-09 15:47:38 +01: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