PulseAudio peeking doesn't work right: every app is faded to mute

Bug #907398 reported by Adam Porter
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Ear Candy
New
Undecided
Unassigned

Bug Description

PulseAudio.py:
...
def pa_stream_request_cb(self, stream, length, index):
...
pa_stream_peek(stream, data, ctypes.c_ulong(length))
...
v = data[length / 4 -1] * 100
if (v < 0):
    v = 0
if (v > 100):
    v = 100
gobject.idle_add(self.volume_meter_cb, index, v)

This just doesn't work. The majority of the time while my music player (Clementine or Pithos) is playing music, (data[length / 4 -1] * 100) ends up nan or 0 or a very "large" negative number, so v = 0, and the client object is set to not active, so it's set to not primary, so it's faded to mute. The rest of the time, it's constantly fading up and down.

I've spent many hours now debugging the code to get to the culprit line (v = data[length / 4 -1] * 100). I tried removing "-1" and "/4" and even "*100", but it's still not stably detecting a level while music is playing. It just doesn't work.

I'm using Kubuntu Natty at the moment.

I'm pushing a branch with much, much debugging code added using the logging class. My branch is based on the "fixes" branch, rev81.

I don't know if anyone will ever find this bug...but right now it seems that all hope is lost for this feature. The only hope I can see, other than fixing the stream peeking, is to rely only upon whether a client has active sinks. But even that's not enough, because a client may leave a sink active while it's not using it (e.g. a paused or finished Flash video in plugin_container).

Revision history for this message
Adam Porter (alphapapa) wrote :

lp:~launchpad-alphapapa/earcandy/debug-907398

Maybe someone else can fix it. Good luck.

Revision history for this message
Red hot smasher (red-hot-smasher) wrote :

Renders earcandy pretty much useless as this basically breaks the main feature and basically just leaves you with a way to enforce a certain volume setting per program that can only be changed in earcandy, which is pretty usless IMO.

Revision history for this message
Francesco Ponzin (francesco-ponzin) wrote :

Same problem, I'm using the repo release on precise pangoline with Unity.
Need to try it with different gui, I don't know if Unity and Ear Candy share the same idea of "focus"

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.