[gstreamer-bugs] [Bug 610364] New: udpsrc allocates buffers with size a lot bigger than needed.

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Thu Feb 18 06:28:46 PST 2010


https://bugzilla.gnome.org/show_bug.cgi?id=610364
  GStreamer | gst-plugins-good | git

           Summary: udpsrc allocates buffers with size a lot bigger than
                    needed.
    Classification: Desktop
           Product: GStreamer
           Version: git
        OS/Version: Mac OS
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-plugins-good
        AssignedTo: gstreamer-bugs at lists.sourceforge.net
        ReportedBy: gmondada at recolive.com
         QAContact: gstreamer-bugs at lists.sourceforge.net
      GNOME target: ---
     GNOME version: ---


Background:
overloaded computer receiving RTP packets through udpsrc with parameter
"buffer-size" set to 1*1024*1024.

Result: 
GLib-ERROR **: gmem.c:136: failed to allocate 1044144 bytes
aborting...

Personal analysis:
I didn't found why g_malloc() fails here but it is not so relevant for this bug
report.

The bug declared here is the size of the buffer being allocated by udpsrc. In
fact, each UDP packet is normally stored in one gst buffer and there is no
apparent reasons to have a so big buffer.

By looking inside the source code, I saw (gstudpsrc.c:470):

  /* ask how much is available for reading on the socket, this should be
exactly
   * one UDP packet. We will check the return value, though, because in some
   * case it can return 0 and we don't want a 0 sized buffer. */
  readsize = 0;
  if (G_UNLIKELY ((ret =
              IOCTL_SOCKET (udpsrc->sock.fd, FIONREAD, &readsize)) < 0))
    goto ioctl_failed;

This code, on Mac OS X, return the total amount of data stored in the reception
buffer. This is not the size of the next UDP packet as expected in the code.

In my understanding, the code is allocating a buffer based on <readsize> to
store a single UDP packet. So, the buffer can be a lot bigger than needed,
generating waste of memory and other side effects.

On the other hand, g_malloc() have no reason to fail (my computer is not
running out of memory). There is probably another bug that will be handled
unlinked to this one.

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