Raspberry Pi 2 v4l2src 'lost frames detected' and high processor usage

Mandar Joshi emailmandar at gmail.com
Sun Nov 6 01:29:00 UTC 2016


Thank you for your response.

>
> First, you should probably add a queue between the capture and the encoder,
> that will slightly reduce the contention.
>
Did that. Helped a little bit.

> The, you should try (not sure if that work on this platforms) to use on
> encoder buffer to save a copy. That can be tried with v4l2src property,
> io-mode=userptr
> (No guaranty).
>
io-mode=userptr gives me an "allocator error". Output attached. (userptr.txt)

I did 3 more things,
1. Reduce input resolution from 1280x720 to 640480
2. Downgrade to kernel 4.1.13-v7+
3. Set v4l2src's io-mode to mmap

There are fewer errors now. but the "lost frames warning does pop up
once every few seconds. However 1280x720 always results in 100% CPU
usage.
640x480 around 25% CPU
-------------- next part --------------
$ GST_DEBUG=3 gst-launch-1.0 v4l2src io-mode=userptr !  video/x-raw,width=1280,height=720,format=I420 ! queue ! omxh264enc ! rtph264pay ! shmsink socket-path=/tmp/logitech wait-for-connection=false sync=false
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
0:00:11.666579162  1421  0x1596030 ERROR          v4l2allocator gstv4l2allocator.c:735:gst_v4l2_allocator_start:<v4l2src0:pool:src:allocator> error requesting 2 buffers: Invalid argument
0:00:11.666932496  1421  0x1596030 ERROR         v4l2bufferpool gstv4l2bufferpool.c:848:gst_v4l2_buffer_pool_start:<v4l2src0:pool:src> we received 0 buffer from device '/dev/video0', we want at least 2
0:00:11.667114267  1421  0x1596030 ERROR             bufferpool gstbufferpool.c:560:gst_buffer_pool_set_active:<v4l2src0:pool:src> start failed
0:00:11.667408017  1421  0x1596030 WARN                 v4l2src gstv4l2src.c:531:gst_v4l2src_decide_allocation:<v4l2src0> error: Failed to allocate required memory.
0:00:11.667559371  1421  0x1596030 WARN                 v4l2src gstv4l2src.c:531:gst_v4l2src_decide_allocation:<v4l2src0> error: Buffer pool activation failed
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
Additional debug info:
/var/tmp/portage/media-plugins/gst-plugins-v4l2-1.10.0/work/gst-plugins-good-1.10.0/sys/v4l2/gstv4l2src.c(531): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Buffer pool activation failed
Execution ended after 0:00:11.358139579
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
0:00:11.669226142  1421  0x1596030 WARN                 basesrc gstbasesrc.c:3179:gst_base_src_prepare_allocation:<v4l2src0> Subclass failed to decide allocation
0:00:11.669537235  1421  0x1596030 WARN                 basesrc gstbasesrc.c:2950:gst_base_src_loop:<v4l2src0> error: Internal data stream error.
0:00:11.669619162  1421  0x1596030 WARN                 basesrc gstbasesrc.c:2950:gst_base_src_loop:<v4l2src0> error: streaming stopped, reason not-negotiated (-4)
Setting pipeline to NULL ...
Freeing pipeline ...


More information about the gstreamer-devel mailing list