High CPU usage in Lollypop (Gstreamer) when song is paused
This is another weird issue I encounter since the switch to PipeWire: sometimes, when I pause a playing song in Lollypop (which just uses Gstreamer), CPU usage will go up immensily and it will stay that way until the song is resumed.
This can be an annoying one to reproduce, but I can almost consistently reproduce it with the following steps:
- Play a FLAC or OPUS file from your drive (the format doesn't seem to matter).
- Move the progress bar (song position) to about 5 seconds before the end of the song.
- Let the song play up until the very last second.
- Pause just before the song ends, on the very last second.
- Watch CPU usage go up.
Most of the time this happens, I see the following messages in the journal:
pipewire-pulse[1218]: pulse-server 0x561683f103e0: [Lollypop] UNDERFLOW channel:0 offset:4429784
pipewire-pulse[1218]: pulse-server 0x561683f103e0: [Lollypop] UNDERFLOW channel:0 offset:12619128
pipewire-pulse[1218]: pulse-server 0x561683f103e0: [Lollypop] UNDERFLOW channel:0 offset:15756288
I did a quick profile with sysprof when it was already happening, but it doesn't show much of interest, except that most time is spent in syscall
(entry_SYSCALL_64_after_hwframe
) in Lollypop (python3
).
Relatedly, one time this happened, seeking back to a previous point of the song and then playing resulted in a bug where wrong parts of the song were playing (i.e. as if a buffer was filled with old content). This jumped around every few seconds to another part of the song, even though I did not touch the seek bar anymore. Could be related to the underflows.
I'm currently running latest master (af38edea).
Could be related to #510 (closed) due to the underflows also happening there.