2

I'm writing a v4l2 driver but I've some problems when is used by gstreamer pipeline. I've implemented theese ioctl operations:

  • vidioc_querycap
  • vidioc_s_fmt_vid_cap
  • vidioc_try_fmt_vid_cap
  • vidioc_enum_frameintervals
  • vidioc_enum_framesizes
  • vidioc_enum_input
  • vidioc_enum_fmt_vid_cap

When I run the gstreamer pipeline (gst-launch-1.0 v4l2src ! video/x-raw,format=RGB,width=4096,height=2160,framerate=60/1 ! fakesink) I receive this error:

ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
Additional debug info:
../../../git/sys/v4l2/gstv4l2src.c(555): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Buffer pool activation failed

This is some of the debug output from gstreamer:

DEBUG                   v4l2 gstv4l2object.c:2858:gst_v4l2_object_setup_pool:<v4l2src0> initializing the capture system
INFO                    v4l2 gstv4l2object.c:2882:gst_v4l2_object_setup_pool:<v4l2src0> accessing buffers via mode 1
LOG                     v4l2 gstv4l2object.c:2891:gst_v4l2_object_setup_pool:<v4l2src0> initiating buffer pool
DEBUG                   v4l2 gstv4l2object.c:4035:gst_v4l2_object_decide_allocation:<v4l2src0> decide allocation
DEBUG                   v4l2 gstv4l2object.c:4061:gst_v4l2_object_decide_allocation:<v4l2src0> allocation: size:0 min:0 max:0 pool:(NULL)
DEBUG                   v4l2 gstv4l2object.c:4088:gst_v4l2_object_decide_allocation:<v4l2src0> read/write mode: no downstream pool, using our own
DEBUG                   v4l2 gstv4l2object.c:4195:gst_v4l2_object_decide_allocation:<v4l2src0> setting own pool config to GstBufferPoolConfig, caps=(GstCaps)"video/x-raw\,\ format\=\(string\)RGB\,\ width\=\(int\)4096\,\ height\=\(int\)2160\,\ framerate\=\(fraction\)60/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive", size=(uint)26542080, min-buffers=(uint)4, max-buffers=(uint)0, allocator=(GstAllocator)"NULL", params=(GstAllocationParams)NULL;
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
Additional debug info:
../../../git/sys/v4l2/gstv4l2src.c(555): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Buffer pool activation failed
Execution ended after 0:00:00.410428919
Setting pipeline to PAUSED ...
LOG                     v4l2 gstv4l2object.c:3913:gst_v4l2_object_unlock:<v4l2src0> start flushing
Setting pipeline to READY ...
LOG                     v4l2 gstv4l2object.c:3913:gst_v4l2_object_unlock:<v4l2src0> start flushing
LOG                     v4l2 gstv4l2object.c:3926:gst_v4l2_object_unlock_stop:<v4l2src0> stop flushing
DEBUG                   v4l2 gstv4l2object.c:3937:gst_v4l2_object_stop:<v4l2src0> stopping
DEBUG                   v4l2 gstv4l2object.c:3945:gst_v4l2_object_stop:<v4l2src0> deactivating pool
Setting pipeline to NULL ...
DEBUG                   v4l2 v4l2_calls.c:719:gst_v4l2_close:<v4l2src0> Trying to close /dev/video0
DEBUG                   v4l2 v4l2_calls.c:464:gst_v4l2_empty_lists:<v4l2src0> deleting enumerations
Freeing pipeline ...

I can't find the cause of the error, maybe I forgot an ioctl operation?

Thank you

Andrea
  • 21
  • 1
  • 7
  • looks like your v4l2 source does not support the resolution you have supplied it with. can you check if the resolution you are requesting is supported or not ? – yashC Mar 25 '19 at 10:30
  • yes, the resolution is correct. In the "vidioc_enum_framesizes" operation I put all the supported discrete frame sizes. I've tried also with smaller sizes but without success. – Andrea Mar 25 '19 at 11:03
  • if I put a wrong resolution the error change from "Failed to allocate required memory" to "Internal data stream error." – Andrea Mar 25 '19 at 14:07
  • I'm working on a similar problem. If you haven't solved it yet, what do get when you run "v4l2-compliance". Specifically for the "Format ioctls, test VIDIOC_G_FBUF", and for the "Buffer ioctls" tests. – Robert McLean Jan 17 '20 at 19:00

0 Answers0