From 46340ced12dfb3a050dcccb8f3ea8aca5a0e5987 Mon Sep 17 00:00:00 2001 From: Vedant Paranjape Date: Sat, 10 Sep 2022 12:07:42 +0530 Subject: 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: error: Could not find a camera named ''. WARN libcamerasrc gstlibcamerasrc.cpp:347:gst_libcamera_src_open: 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: 5646849b59fe ("test: gstreamer: Check availability of cameras before running") Signed-off-by: Vedant Paranjape Reviewed-by: Umang Jain Tested-by: Rishikesh Donadkar Reviewed-by: Rishikesh Donadkar Signed-off-by: Umang Jain --- test/gstreamer/gstreamer_test.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test/gstreamer/gstreamer_test.cpp') diff --git a/test/gstreamer/gstreamer_test.cpp b/test/gstreamer/gstreamer_test.cpp index 4947b7bb..fe8e8e15 100644 --- a/test/gstreamer/gstreamer_test.cpp +++ b/test/gstreamer/gstreamer_test.cpp @@ -73,7 +73,7 @@ GstreamerTest::GstreamerTest(unsigned int numStreams) * Atleast one camera should be available with numStreams streams, * otherwise skip the test entirely. */ - if (!checkMinCameraStreams(numStreams)) { + if (!checkMinCameraStreamsAndSetCameraName(numStreams)) { status_ = TestSkip; return; } @@ -81,7 +81,7 @@ GstreamerTest::GstreamerTest(unsigned int numStreams) status_ = TestPass; } -bool GstreamerTest::checkMinCameraStreams(unsigned int numStreams) +bool GstreamerTest::checkMinCameraStreamsAndSetCameraName(unsigned int numStreams) { libcamera::CameraManager cm; bool cameraFound = false; @@ -93,6 +93,7 @@ bool GstreamerTest::checkMinCameraStreams(unsigned int numStreams) continue; cameraFound = true; + cameraName_ = camera->id(); break; } @@ -121,6 +122,7 @@ int GstreamerTest::createPipeline() return TestFail; } + g_object_set(libcameraSrc_, "camera-name", cameraName_.c_str(), NULL); g_object_ref_sink(libcameraSrc_); return TestPass; -- cgit v1.2.1