I tried a gst-launch-1.0 which used to work, and which works if I use ximagesrc instead of v4l2src. I got the error message below. ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory. Additional debug info: gstv4l2src.c(658): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Buffer pool activation failed I had problems with cheese too which mentioned v4l2src. The wencam works fine with obs-studio
Im having the same problem on 13-current with cheese the webcam works on firefox but not on cheese cheese libGL: pci id for fd 16: 8086:0416, driver i965 libGL: OpenDriver: trying /usr/local/lib/dri/i965_dri.so libGL: Using DRI3 for screen 0 (cheese:58465): Gtk-WARNING **: 21:25:41.380: Theme parsing error: cheese.css:7:35: The style property GtkScrollbar:min-slider-length is deprecated and shouldn't be used anymore. It will be removed in a future version (cheese:58465): cheese-WARNING **: 21:25:42.168: Failed to allocate required memory.: gstv4l2src.c(658): gst_v4l2src_decide_allocation (): /GstCameraBin:camerabin/GstWrapperCameraBinSrc:camera_source/GstBin:bin35/GstV4l2Src:v4l2src1: Buffer pool activation failed
Created attachment 213136 [details] catch EINVAL errno when probing DMA capabilities to be dropped into multimedia/gstreamer1-plugins-good/files/ (bump PORTREVISION on multimedia/gstreamer1-plugins-v4l2). poking at an old-ish Logitech C270 cam, I noticed the same problem ("Buffer pool activation failed" and camera not working in gstreamer-based applications). Working backwards through gstreamer and cuse) it became obvious that gstreamer probes the DMA capabilities of the device using ioctls, expecting ENOTTY (as it is customary when the request is not applicable to the object in question) in case DMA capabilities are not available. Unfortunately, FreeBSD's cuse returns EINVAL for this ioctl. As it's easier to fix the port than to fix the kernel: Here's the workaround, catching both ENOTTY and EINVAL on the DMA probing. With that, my camery works with gstreamer.
hselasky: as the author of cuse, can you give some input on the ioctls here?
A commit references this bug: Author: cmt Date: Wed May 6 13:53:34 UTC 2020 New revision: 534176 URL: https://svnweb.freebsd.org/changeset/ports/534176 Log: gstreamer1-plugins-v4l2: fix for (some) webcams The gstreamer v4l2 plugin probes the DMA capabilities of the webcam device via ioctl VIDIOC_EXPBUF, expecting ENOTTY in case that's not implemented (and will act accordingly). On our cuse, we get EINVAL for that case (which, from my reading of ioctl(2) woulndn't be correct here), which gstreamer neither expects nor handles and thus cannot use this device as a video source. As we cannot fix the kernel on short notice (cuse is part of the base system), the workaround is to handle EINVAL like ENOTTY in this specific place. (Tested with an old Logitech camera). PR: 236673 Approved by: maintainer-timeout (multimedia) Changes: head/multimedia/gstreamer1-plugins-good/files/patch-sys_v4l2_gstv4l2object.c head/multimedia/gstreamer1-plugins-v4l2/Makefile
committed as ports r534176
Did this get undone at some point? I am getting an identical error now on 14.0-STABLE using net-im/dino. v4l-compliance shows a bunch of similar-seeming test failures: Codec ioctls (Input 0): fail: v4l2-test-codecs.cpp(53): ret != 0 test VIDIOC_(TRY_)ENCODER_CMD: FAIL fail: v4l2-test-codecs.cpp(90): idx.reserved not zeroed test VIDIOC_G_ENC_INDEX: FAIL fail: v4l2-test-codecs.cpp(122): ret != 0 test VIDIOC_(TRY_)DECODER_CMD: FAIL Buffer ioctls (Input 0): fail: v4l2-test-buffers.cpp(589): userptr_valid ^ !!(caps & V4L2_BUF_CAP_SUPPORTS_USERPTR) test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL fail: v4l2-test-buffers.cpp(783): VIDIOC_EXPBUF is supported, but the V4L2_MEMORY_MMAP support is missing or malfunctioning. fail: v4l2-test-buffers.cpp(784): VIDIOC_EXPBUF is supported, but the V4L2_MEMORY_MMAP support is missing, probably due to earlier failing format tests. test VIDIOC_EXPBUF: OK (Not Supported) test Requests: OK (Not Supported)
Created attachment 255039 [details] Workaround for EINVAL from VIDIOC_EXPBUF ioctl The original patch for this issue (PR 236673) seems to have been lost. FreeBSD 14.1 is still returning EINVAL for the VIDIOC_EXPBUF ioctl, which breaks gstreamer-based V4L applications. The attach patch applies cleanly to multimedia/gstreamer1-plugins-good version 1.24.9, and allows my Logitech webcam to work again with gstreamer-based applications (specifically the Dino XMPP client).
(In reply to Nathan Whitehorn from comment #6) You are correct, the issue is still present. My attached patch fixes the issue, you can apply to your ports tree with the following command: patch -d /your/ports/tree -u < gstreamer1-plugins-good-fix-v4l-einval.patch
This bug should be reopened. I suppose if no activity I'll file a new one. My patch still fixes the problem.