[Bug 769765] New: v4l2: Skip buffers that have the error flag set

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Thu Aug 11 20:42:25 UTC 2016


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

            Bug ID: 769765
           Summary: v4l2: Skip buffers that have the error flag set
    Classification: Platform
           Product: GStreamer
           Version: 1.8.1
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gst-plugins-good
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: gnome at williammanley.net
        QA Contact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---

Created attachment 333134
  --> https://bugzilla.gnome.org/attachment.cgi?id=333134&action=edit
patch

If the error flag is set we can't trust the rest of the fields in the
`v4l2_buffer` struct.  In particular I've seen problems where the
`bytesused` field of `v4l2_buffer` would be a silly number causing the
later call to:

    gst_memory_resize (group->mem[i], 0, group->planes[i].bytesused);

to result in this error to be printed:

    (pulsevideo:11): GStreamer-CRITICAL **: gst_memory_resize: assertion 'size
+ mem->offset + offset <= mem->maxsize' failed

besides causing who-knows what other problems.

We reenqueue these buffers and return `GST_V4L2_FLOW_CORRUPTED_BUFFER` so
this will not be a fatal error and dequeue will be attempted once again by
the loop in `gst_v4l2_buffer_pool_dqbuf`.

The invalid `v4l2_buffer` I saw from my capture device was:

    buffer = {
      index = 0,
      type = 1,
      bytesused = 534748928, // <- Invalid
      flags = 8260, // V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC | V4L2_BUF_FLAG_ERROR
| V4L2_BUF_FLAG_DONE
      field = 01330, // <- Invalid
      timestamp = {
        tv_sec = 0,
        tv_usec = 0
      },
      timecode = {
        type = 0,
        flags = 0,
        frames = 0 '\000',
        seconds = 0 '\000',
        minutes = 0 '\000',
        hours = 0 '\000',
        userbits = "\000\000\000"
      },
      sequence = 0,
      memory = 2,
      m = {
        offset = 3537219584,
        userptr = 140706665836544, // Could be nonsense, not sure
        planes = 0x7ff8d2d5b000,
        fd = -757747712
      },
      length = 2764800,
      reserved2 = 0,
      reserved = 0
    }

This is from gdb with my own annotations added.

Tested with gst-plugins-good 1.8.1, a Magewell XI100DUSB-HDMI video
capture device and kernel 3.13 using a dodgy HDMI cable which is great at
breaking HDMI capture devices.  I'm using io-mode=userptr and have built
gst-plugins-good without libv4l.

-- 
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