[libcamera-devel] [PATCH] test: gstreamer_single_stream: Check for cameras before running
Jacopo Mondi
jacopo at jmondi.org
Thu Jul 21 12:46:55 CEST 2022
Hi Umang,
On Thu, Jul 21, 2022 at 04:00:20PM +0530, Umang Jain via libcamera-devel wrote:
> Before running or setting up the pipeline, check for cameras availablity
> first. If no cameras are available, skip the test.
>
> Signed-off-by: Umang Jain <umang.jain at ideasonboard.com>
Is this to fix the recurring failing test on rpi ?
Nit: could you add a Fixes tag ? I also used Reported-by: with a link
to a failing build from buildbot. Not that we use it now, but it's
nice for statistics ?
> ---
> test/gstreamer/gstreamer_single_stream_test.cpp | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/test/gstreamer/gstreamer_single_stream_test.cpp b/test/gstreamer/gstreamer_single_stream_test.cpp
> index a0dd12cf..1e0801e8 100644
> --- a/test/gstreamer/gstreamer_single_stream_test.cpp
> +++ b/test/gstreamer/gstreamer_single_stream_test.cpp
> @@ -8,6 +8,8 @@
> #include <iostream>
> #include <unistd.h>
>
> +#include <libcamera/libcamera.h>
> +
> #include <gst/gst.h>
>
> #include "gstreamer_test.h"
> @@ -29,6 +31,17 @@ protected:
> if (status_ != TestPass)
> return status_;
>
> + libcamera::CameraManager cm;
> + cm.start();
> +
> + bool cameraFound = cm.cameras().size() > 1 ? true : false;
> + if (!cameraFound) {
> + cm.stop();
> + return TestSkip;
> + }
> +
> + cm.stop();
> +
The multistream test has a very similar:
/* Check if platform supports multistream capture */
libcamera::CameraManager cm;
cm.start();
bool cameraFound = false;
for (auto &camera : cm.cameras()) {
if (camera->streams().size() > 1) {
cameraName_ = camera->id();
cameraFound = true;
cm.stop();
break;
}
}
if (!cameraFound) {
cm.stop();
return TestSkip;
}
Is this something that should go in the base class ?
> const gchar *streamDescription = "videoconvert ! fakesink";
> g_autoptr(GError) error0 = NULL;
> stream0_ = gst_parse_bin_from_description_full(streamDescription, TRUE,
> --
> 2.31.1
>
More information about the libcamera-devel
mailing list