[Bug 761940] New: v4l2: deadlock when using dmabuf-import (zero-copy) between two V4L2 devices

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Fri Feb 12 13:16:53 UTC 2016


https://bugzilla.gnome.org/show_bug.cgi?id=761940

            Bug ID: 761940
           Summary: v4l2: deadlock when using dmabuf-import (zero-copy)
                    between two V4L2 devices
    Classification: Platform
           Product: GStreamer
           Version: 1.4.5
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gst-plugins-good
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: clopez at igalia.com
        QA Contact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---

Hi,

I'm working on a Freescale I.MX6 board that has a hardware video encoder (CODA)
that is exposed as a V4L2 device (/dev/video2).

This board has also a camera connected that is exposed as another V4L2 device
(/dev/video0).

I'm using GStreamer to encode and stream video from the camera.
The pipeline I'm using is this:

1. On the board: To record, encode and stream the video:
$ gst-launch-1.0 v4l2src ! video/x-raw,width=1280,height=720,framerate=30/1 !
v4l2video2h264enc ! h264parse ! rtph264pay pt=96 config-interval=5 ! udpsink
host=${my.local.ip.addr} port=5555 


2. On my PC to receive the video and measure the FPS at the same time:
$ gst-launch-1.0 -e -v udpsrc port=5555 ! application/x-rtp, payload=96 !
rtpjitterbuffer ! rtph264depay ! avdec_h264 ! fpsdisplaysink sync=false
text-overlay=false 


Everything works fine, on my PC I get the video playback at 30FPS without
problems.


The issue is that this is taking around 45% of CPU usage on the board due to
the memcopies of raw 720p video from v4l2src0:pool:src to
v4l2video2h264enc0:pool:sink

So, to fix that I want to use zero-copy (via dmabuf-import).

So, I change the pipeline on the board to:


gst-launch-1.0 v4l2src io-mode=dmabuf !
video/x-raw,width=1280,height=720,framerate=30/1 ! v4l2video2h264enc
output-io-mode=dmabuf-import ! h264parse ! rtph264pay pt=96 config-interval=5 !
udpsink host=${my.local.ip.addr} port=5555 

The issue is that is not working. I get a deadlock.

There are 3 bufferpools at play here:


  - v4l2src0:pool:src             -> The source of the video from the camera
V4L2 device /dev/video0
  - v4l2video2h264enc0:pool:sink  -> The input of the encoder (the sink pad of
the V4L2 hardware encoder at /dev/video2). It matches the output-io-mode
property of v4l2video2h264enc
  - v4l2video2h264enc0:pool:src      -> The output of the enconder (The src pad
of the V4L2 hardware encoder at /dev/video2). It matches the capture-io-mode
property of v4l2video2h264enc

  See the attached files properties_of_v4l2src.txt and
properties_of_v4l2video2h264enc.txt for more info


Some comments about the versions used:
 - I'm using gstreamer and gstreamer-plugins-good 1.4.5
 - For the v4l2video encoder element of gstreamer-plugins-good I'm using the
patches available in bug 728438 <https://gitlab.com/veo-labs/gst-plugins-good>

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list