Skip to content

librespot takes 97% CPU, music replay stutters #504

@removogel

Description

@removogel

Compatible OS

  • I'm running Raspotify on a compatible OS

Latest Version

  • I'm running the latest version of Raspotify

Due Diligence

  • I have done my due diligence

What happened?

Since a few days music replay is starting to stutter after a few minutes working fine.
/usr/bin/libespot takes up to 97% CPU

Did a check with journalctl, there is an error writing to PCM

ALSA works fine, just testet with aplay as documented in log below

Relevant log output

Jan 23 15:25:21 raspberrypi librespot[459]: [2022-01-23T14:25:21Z WARN  librespot_playback::audio_backend::alsa] Error writing from AlsaSink buffer to PCM, trying to recover, ALSA function 'snd_pcm_writei'
Jan 23 15:25:21 raspberrypi librespot[459]: ALSA lib pcm.c:8424:(snd_pcm_recover) underrun occurred


sudo aplay -Dhw:0,0 --dump-hw-params /usr/share/sounds/alsa/Front_Right.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Right.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
HW Params of device "hw:0,0":
--------------------
ACCESS:  MMAP_INTERLEAVED RW_INTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: [16 32]
CHANNELS: [1 2]
RATE: [32000 48000]
PERIOD_TIME: [1000 8192000]
PERIOD_SIZE: [32 262144]
PERIOD_BYTES: [64 524288]
PERIODS: [2 1024]
BUFFER_TIME: (1333 16384000]
BUFFER_SIZE: [64 524288]
BUFFER_BYTES: [128 1048576]
TICK_TIME: ALL
--------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions