[Bug 705678] New: sysmem allocator copies too much

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Thu Aug 8 07:31:19 PDT 2013


https://bugzilla.gnome.org/show_bug.cgi?id=705678
  GStreamer | gstreamer (core) | git

           Summary: sysmem allocator copies too much
    Classification: Platform
           Product: GStreamer
           Version: git
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gstreamer (core)
        AssignedTo: gstreamer-bugs at lists.freedesktop.org
        ReportedBy: thaytan at noraisin.net
         QAContact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---


Not sure whether this is a bug in the sysmem allocator, or in elements. In
short, v4l2src ! rtpjpegpay consumes 100% cpu, almost all in memcpy.

v4l2src emits (JPEG) buffers of about 60KB each with the NO_SHARE memory flag,
and rtpjpegpay tries to cut each buffer into 42 or so sub-buffers. Each
sub-buffer copies the memory using gst_buffer_copy_region, but it turns out
that the sysmem allocator handles that by allocating a new maxsize'd 600KB
memory region (the maxsize of the full original buffer), and copying the full
600KB into it, then returning a new GstMemory pointing to the appropriate
offset in that memory.

Of course, this means it copies around 42 * 600KB per frame, instead of ~ 60KB
or total data.

Modifying rtpjpegpay to do a single gst_memory_copy_region (... 0, size) at the
start to get a share-able buffer reduces CPU consumption for the pipeline to <
1%, but it's wasteful to copy the buffer in the general case.

I think the correct fix is to make the sysmem allocator respect the requested
offset/size parameters, even though it means returning a block that can't be
resized back to the same maxsize as the original GstMemory. It should probably
preserve the original alignment though.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- 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