[libcamera-devel] raspberrypi pipeline gstreamer bug

Xishan Sun sunxishan at gmail.com
Wed Jun 10 11:57:27 CEST 2020


Trying to use gstreamer plugin on raspberrypi platform.


For very simple test started with

gst-launch-1.0 libcamerasrc ! fakesink

will get error:

Setting pipeline to PAUSED ...
[5:14:54.902707301] [6325]  INFO Camera camera_manager.cpp:277 libcamera
v0.0.0+1423-78150899-dirty
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
ERROR: from element /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0:
Internal data stream error.
Additional debug info:
../src/gstreamer/gstlibcamerasrc.cpp(461): gst_libcamera_src_task_enter ():
/GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.000989404
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

debug tracking all the way down to file src/gstreamer/gstlibcamerasrc.cpp
line 377, the function

g_autoptr(GstCaps) filter =
gst_libcamera_stream_formats_to_caps(stream_cfg.formats());

will always return empty filter list, since stream_cfg.formats() return
empty.

further down to the source:
src/libcamera/pipeline/raspberrypi/raspberrypi.cpp line 515, in the
function

CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera
*camera, const StreamRoles &roles)

there is no configuration for the output format sets. In order to generate
the format sets, I copied the code from uvc pipeline. add it into line 522

....
        if (roles.empty())
                 return config;

        std::map<V4L2PixelFormat, std::vector<SizeRange>> v4l2Formats =
                 data->isp_[Isp::Output0].dev()->formats();
        std::map<PixelFormat, std::vector<SizeRange>> deviceFormats;
        std::transform(v4l2Formats.begin(), v4l2Formats.end(),
                        std::inserter(deviceFormats, deviceFormats.begin()),
                        [&](const decltype(v4l2Formats)::value_type
&format) {
                                return decltype(deviceFormats)::value_type{
                                        format.first.toPixelFormat(),
                                        format.second
                                };
                         });
         StreamFormats formats(deviceFormats);

         for (const StreamRole role : roles) {
                 //StreamConfiguration cfg{};
                 StreamConfiguration cfg(formats);
....

it can solve the issue but obviously it is not the best way to do it. Could
you please revise the code here and advice me a better solution?

Thanks

-- 
Xishan Sun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20200610/4cc073b4/attachment.htm>


More information about the libcamera-devel mailing list