libcamera/test/gstreamer/gstreamer_test.h
Vedant Paranjape 46340ced12 test: gstreamer: Fix failure of gstreamer_multistream_test
Multistream test failed with the following logs, to run on Raspberry Pi 4 due
to a bug introduced in one of the recent patches refactoring the code
that fails to set the camera-name property with a valid camera id
string.

WARN libcamerasrc gstlibcamerasrc.cpp:347:gst_libcamera_src_open:<libcamera> error: Could not find a camera named ''.
WARN libcamerasrc gstlibcamerasrc.cpp:347:gst_libcamera_src_open:<libcamera> error: libcamera::CameraMananger::get() returned nullptr

This patch assigns the camera->id() to the variable cameraName_ that is
later used to set element property "camera-name" needed to call the
specific camera which supports multistreams. Move the code to set
element property "camera-name" to base class GstreamerTest.

Fixes: 5646849b59 ("test: gstreamer: Check availability of cameras before running")
Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Rishikesh Donadkar <rishikeshdonadkar@gmail.com>
Reviewed-by: Rishikesh Donadkar <rishikeshdonadkar@gmail.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2022-09-12 22:44:54 +05:30

34 lines
625 B
C++

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2021, Vedant Paranjape
*
* gstreamer_test.cpp - GStreamer test base class
*/
#pragma once
#include <iostream>
#include <unistd.h>
#include <gst/gst.h>
class GstreamerTest
{
public:
GstreamerTest(unsigned int numStreams = 1);
virtual ~GstreamerTest();
protected:
virtual int createPipeline();
int startPipeline();
int processEvent();
void printError(GstMessage *msg);
std::string cameraName_;
GstElement *pipeline_;
GstElement *libcameraSrc_;
int status_;
private:
bool checkMinCameraStreamsAndSetCameraName(unsigned int numStreams);
};