[Bug 642720] New: audiotestsrc: pipelines with multiple instances with wave=gaussian-noise, white-noise, or pink-noise are very slow

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Fri Feb 18 15:38:03 PST 2011


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

           Summary: audiotestsrc: pipelines with multiple instances with
                    wave=gaussian-noise, white-noise, or pink-noise are
                    very slow
    Classification: Desktop
           Product: GStreamer
           Version: git
        OS/Version: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-plugins-base
        AssignedTo: gstreamer-bugs at lists.freedesktop.org
        ReportedBy: lsinger at caltech.edu
         QAContact: gstreamer-bugs at lists.freedesktop.org
      GNOME target: ---
     GNOME version: ---


Created an attachment (id=181284)
 --> (https://bugzilla.gnome.org/attachment.cgi?id=181284)
proposed patch

Pipelines which contain more than one instance of audiotestsrc with the "wave"
property set to "gaussian-noise", "pink-noise", or "white-noise" are very slow
because audiotestsrc uses global, lock-protected random number generators.

For an example of such a global lock, see the glib source code:
<http://git.gnome.org/browse/glib/tree/glib/grand.c?id=fdaaa22b58b20c285bc0c328cd6a97bb6c0f0258#n610>

The attached patch has each instance of audiotestsrc create its own instance of
GRand (whose seed is taken from /dev/urandom) so that they don't need to
contend over those global locks.

I performed a test in which I had a simple pipeline that looked like this:

gst-launch adder name=add ! \
    audio/x-raw-float,rate=16384,width=64 ! \
    fakesink num-buffers=10000 sync=false \
    audiotestsrc wave=white-noise ! add. \
    audiotestsrc wave=white-noise ! add. \
    audiotestsrc wave=white-noise ! add. \
    ...
    audiotestsrc wave=white-noise ! add.

where I varied the number of instances of audiotestsrc from 1 to 16, and tried
setting "wave" to "sine", "gaussian-noise", "pink-noise", or "white-noise".

I found that my patch:
 - had no effect on the performance of "sine" (expected).
 - made "pink-noise" take only 70% of the amount of time it took without the
patch
 - made "white-noise" and "gaussian-noise" take less than 1% of the time they
took without the patch

So, I got a speedup for all three types of noise, but I got a speedup of better
than a factor of 100 for white-noise and gaussian-noise.

I performed this test on a 2.53 GHz Intel Core 2 Duo MacBook Pro.

Another possible resolution (if it was desirable to have all instances of
audiotestsrc share the same seed) would be to have the element **class** keep a
single instance of GRand, and have the instances block for access to it on the
buffer level.  This, however, would not perform as well as this patch on
multicore machines.

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