[Minor] CPU usage

Bug #734400 reported by FM33
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Audio Recorder
Fix Committed
Undecided
Moma

Bug Description

When timer is active, even if there is no sound detection (and even if all lines are commented), the program uses 6% CPU permanently.

Revision history for this message
moma (osmoma) wrote :

Hello,
Very good observation.
The listener process is still running even the timer has no conditions (the timer has no commands, it's empty).

The listener (in gst-listener.c) is started by the timer (in timer.c). And the listener collects signal level (audio level decibel) values.

I have now modified the code so it switches the listener off when the timer is empty.

Notice that the listener creates a recorder process for the selected devices. It is an ordinary GStreamer recorder that outputs to a "fakesink" element. GStreamer delivers the signal values (decibel level values) via listener_message_handler(...) callback.

The listener process is a quite heavy and CPU intensive. However I haven't found a better way to gather the signal/level values.

Please see:
http://bazaar.launchpad.net/~osmoma/audio-recorder/trunk/view/head:/src/gst-listener.c

Functions:
static GstElement *listener_create_pipeline(gchar *audio_source, GList *dev_list) {
...
}

And
static gboolean listener_message_handler(GstBus * bus, GstMessage * message, gpointer data) {
...
}

Revision history for this message
moma (osmoma) wrote :

Re-hello,
A small addition to my previous post.
The listener (in gst-listener.c) is only needed when the timer has audio-level related commands. For example these commands will need level-data from the listener:
start if audio 5s 7%
start if voice -17 dB
stop if silence

While these commands do not need it. The timer.c can handle these by itself.
start at 10:30 pm
stop at 20:00 | 1.2GB | 1 h 20 min

I may add a test to the timer that checks the timer conditions, and starts the listener (CPU hungry dummy recorder) only when needed by the "silence", "sound" and "audio" commands.

Changed in audio-recorder:
assignee: nobody → Moma (moma-linux)
status: New → Confirmed
moma (osmoma)
Changed in audio-recorder:
status: Confirmed → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.