[Bug 698960] New: High CPU load with alsa

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Fri Apr 26 08:15:07 PDT 2013


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

           Summary: High CPU load with alsa
    Classification: Platform
           Product: GStreamer
           Version: 1.0.6
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-plugins-base
        AssignedTo: gstreamer-bugs at lists.freedesktop.org
        ReportedBy: visechelle at gmail.com
         QAContact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---


Created an attachment (id=242584)
 View: https://bugzilla.gnome.org/attachment.cgi?id=242584
 Review: https://bugzilla.gnome.org/review?bug=698960&attachment=242584

Patch

On an embedded board with an ARMv7 processor, I notice high CPU load from time
to time using such a pipeline:

alsasrc ! audioconvert ! rtpL16pay ! udpsink

This can also be noticed with such simple pipeline (but less obvious):

alsasrc ! fakesink

After further investigation, I noticed that in applications using alsa-lib
(e.g.: arecord, aplay, csound
(http://www.csounds.com/manual/html/UsingRealTime.html)), if not set manually,
buffer_size and period_size are a power of 2. And indeed, after applying such a
constraint, the load peak disappeared. The "funny" thing is that without being
a power of 2, I had a really low CPU load and sometime for a certain time a
very high load, then having a power of 2 averaged the load. But the buffers
were always passing through, there was no burst of buffers which would
explained such a high load.
I also made the test using arecord and aplay and setting buffer_size and
period_size to something not a power of 2 and the high CPU load appeared also.
FYI, I did not notice high CPU load on a multi-core processor but that probably
hidden by the power of such a processor.

In the patch provided in attachment, as alsasrc/sink derived from
audiobasesrc/sink indirectly, and these structures only allow to set the
buffer_time and period_time. It calculates in alsasrc/sink the buffer_size and
period_size from the buffer_time and period_time and round up to the next power
of 2.

Any comments?

Cheers

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