allquixotic / tribblify

PulseAudio -> Icecast/Shoutcast streaming source with tag support.
GNU Lesser General Public License v3.0
11 stars 0 forks source link

Reducing CPU load when the watched sink is IDLE? #3

Closed RJVB closed 3 years ago

RJVB commented 3 years ago

When the selected PulseAudio device is in state: IDLE I see that tribblify still consumes about 15-20% CPU. Wouldn't it be possible to get notified on device state changes, and do something more clever than busy-waiting while the state is IDLE?

allquixotic commented 3 years ago

Hello, this code is not being maintained by me any longer, as I no longer use it. I suggest looking at librespot instead. I never noticed particularly high CPU usage when I used to use this, but I was running it on a fairly high-end Xeon. Unfortunately I am not immediately sure how to solve your problem, and my focus is elsewhere these days, so I won't be able to provide you a satisfying answer to this due to lack of time.

RJVB commented 3 years ago

Well, that's a pity. Librespot is of no interest to me because 1) I stream any source of music I want over icecast and 2) I don't have Spotify premium.

A shame you didn't write this in a more common programming language; that would have made continuing its development a lot easier for me!

Anyway, if you do think of a way how to query the PulseAudio device's playback state I'd appreciate knowing it; to be honest I wouldn't really know even how to begin figuring that out...

allquixotic commented 3 years ago

Check out librespot's GStreamer integration (which I also wrote). You can write a simple pipeline to stream librespot to icecast. See https://github.com/librespot-org/librespot/wiki/Audio-Backends

RJVB commented 3 years ago

As I said, librespot is of no use to me.

But never mind, I found that DarkIce does exactly what I want, with less CPU overhead while streaming and a negligible amount when I'm not playing anything. It doesn't do metadata (that I know of) but I wasn't using that part anyway (I'm either at the computer I'm streaming from, or too far from the device that reads from the stream).