[GH-ISSUE #895] ERROR ALSA function 'snd_pcm_hw_params_set_buffer_time_near' failed with error 'EINVAL: Invalid argument' on playback on Vero4K #443

Closed
opened 2026-02-27 19:30:39 +03:00 by kerem · 34 comments
Owner

Originally created by @oebeledrijfhout on GitHub (Nov 28, 2021).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/895

Originally assigned to: @roderickvd on GitHub.

On my Vero4K (OSMC) I get the following error on playback:

[2021-11-28T23:21:41Z ERROR librespot_playback::player] Audio Sink Error Invalid Parameters: <AlsaSink> Hardware, ALSA function 'snd_pcm_hw_params_set_buffer_time_near' failed with error 'EINVAL: Invalid argument'

The librespot command:

osmc@osmc0:~$ /usr/bin/librespot --name DEBUG --device-type speaker --backend alsa --bitrate 320 --disable-audio-cache --enable-volume-normalisation --volume-ctrl linear --initial-volume 100 --verbose
[2021-11-28T23:21:14Z INFO  librespot] librespot 0.3.1 bbd575e (Built on 2021-11-26, Build ID: a6e0Ery3, Profile: release)

I have nothing in /etc/asound.conf or ~/.asoundrc. Output of aplay -l:

osmc@osmc0:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: AMLMESONAUDIO [AML-MESONAUDIO], device 0: I2S T9015-audio-hifi-0 []
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: AMLMESONAUDIO [AML-MESONAUDIO], device 1: SPDIF dit-hifi-1 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: AMLMESONAUDIO [AML-MESONAUDIO], device 2: PCM pcm2bt-pcm-2 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

and aplay -L:

osmc@osmc0:~$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
btaudio
    Bluetooth Audio
default:CARD=AMLMESONAUDIO
    AML-MESONAUDIO,
    Default Audio Device
sysdefault:CARD=AMLMESONAUDIO
    AML-MESONAUDIO,
    Default Audio Device
hdmi:CARD=AMLMESONAUDIO,DEV=0
    AML-MESONAUDIO,
    HDMI Audio Output
dmix:CARD=AMLMESONAUDIO,DEV=0
    AML-MESONAUDIO,
    Direct sample mixing device
dmix:CARD=AMLMESONAUDIO,DEV=1
    AML-MESONAUDIO,
    Direct sample mixing device
dmix:CARD=AMLMESONAUDIO,DEV=2
    AML-MESONAUDIO,
    Direct sample mixing device
dsnoop:CARD=AMLMESONAUDIO,DEV=0
    AML-MESONAUDIO,
    Direct sample snooping device
dsnoop:CARD=AMLMESONAUDIO,DEV=1
    AML-MESONAUDIO,
    Direct sample snooping device
dsnoop:CARD=AMLMESONAUDIO,DEV=2
    AML-MESONAUDIO,
    Direct sample snooping device
hw:CARD=AMLMESONAUDIO,DEV=0
    AML-MESONAUDIO,
    Direct hardware device without any conversions
hw:CARD=AMLMESONAUDIO,DEV=1
    AML-MESONAUDIO,
    Direct hardware device without any conversions
hw:CARD=AMLMESONAUDIO,DEV=2
    AML-MESONAUDIO,
    Direct hardware device without any conversions
plughw:CARD=AMLMESONAUDIO,DEV=0
    AML-MESONAUDIO,
    Hardware device with all software conversions
plughw:CARD=AMLMESONAUDIO,DEV=1
    AML-MESONAUDIO,
    Hardware device with all software conversions
plughw:CARD=AMLMESONAUDIO,DEV=2
    AML-MESONAUDIO,
    Hardware device with all software conversions

I reported this originally in https://github.com/dtcooper/raspotify/issues/466 there are some more details there.

Originally created by @oebeledrijfhout on GitHub (Nov 28, 2021). Original GitHub issue: https://github.com/librespot-org/librespot/issues/895 Originally assigned to: @roderickvd on GitHub. On my Vero4K (OSMC) I get the following error on playback: ``` [2021-11-28T23:21:41Z ERROR librespot_playback::player] Audio Sink Error Invalid Parameters: <AlsaSink> Hardware, ALSA function 'snd_pcm_hw_params_set_buffer_time_near' failed with error 'EINVAL: Invalid argument' ``` The librespot command: ``` osmc@osmc0:~$ /usr/bin/librespot --name DEBUG --device-type speaker --backend alsa --bitrate 320 --disable-audio-cache --enable-volume-normalisation --volume-ctrl linear --initial-volume 100 --verbose [2021-11-28T23:21:14Z INFO librespot] librespot 0.3.1 bbd575e (Built on 2021-11-26, Build ID: a6e0Ery3, Profile: release) ``` I have nothing in `/etc/asound.conf` or `~/.asoundrc`. Output of `aplay -l`: ``` osmc@osmc0:~$ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: AMLMESONAUDIO [AML-MESONAUDIO], device 0: I2S T9015-audio-hifi-0 [] Subdevices: 0/1 Subdevice #0: subdevice #0 card 0: AMLMESONAUDIO [AML-MESONAUDIO], device 1: SPDIF dit-hifi-1 [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: AMLMESONAUDIO [AML-MESONAUDIO], device 2: PCM pcm2bt-pcm-2 [] Subdevices: 1/1 Subdevice #0: subdevice #0 ``` and `aplay -L`: ``` osmc@osmc0:~$ aplay -L null Discard all samples (playback) or generate zero samples (capture) btaudio Bluetooth Audio default:CARD=AMLMESONAUDIO AML-MESONAUDIO, Default Audio Device sysdefault:CARD=AMLMESONAUDIO AML-MESONAUDIO, Default Audio Device hdmi:CARD=AMLMESONAUDIO,DEV=0 AML-MESONAUDIO, HDMI Audio Output dmix:CARD=AMLMESONAUDIO,DEV=0 AML-MESONAUDIO, Direct sample mixing device dmix:CARD=AMLMESONAUDIO,DEV=1 AML-MESONAUDIO, Direct sample mixing device dmix:CARD=AMLMESONAUDIO,DEV=2 AML-MESONAUDIO, Direct sample mixing device dsnoop:CARD=AMLMESONAUDIO,DEV=0 AML-MESONAUDIO, Direct sample snooping device dsnoop:CARD=AMLMESONAUDIO,DEV=1 AML-MESONAUDIO, Direct sample snooping device dsnoop:CARD=AMLMESONAUDIO,DEV=2 AML-MESONAUDIO, Direct sample snooping device hw:CARD=AMLMESONAUDIO,DEV=0 AML-MESONAUDIO, Direct hardware device without any conversions hw:CARD=AMLMESONAUDIO,DEV=1 AML-MESONAUDIO, Direct hardware device without any conversions hw:CARD=AMLMESONAUDIO,DEV=2 AML-MESONAUDIO, Direct hardware device without any conversions plughw:CARD=AMLMESONAUDIO,DEV=0 AML-MESONAUDIO, Hardware device with all software conversions plughw:CARD=AMLMESONAUDIO,DEV=1 AML-MESONAUDIO, Hardware device with all software conversions plughw:CARD=AMLMESONAUDIO,DEV=2 AML-MESONAUDIO, Hardware device with all software conversions ``` I reported this originally in https://github.com/dtcooper/raspotify/issues/466 there are some more details there.
kerem 2026-02-27 19:30:39 +03:00
  • closed this issue
  • added the
    bug
    audio
    labels
Author
Owner

@JasonLG1979 commented on GitHub (Nov 29, 2021):

To recap The device fails with both snd_pcm_hw_params_set_buffer_time_near and snd_pcm_hw_params_set_buffer_size_near there doesn't seem to be a way to set the buffer size on it?

@roderickvd it always seems to be these little embedded devices or Kodi these days?

I'm thinking with as much trouble as we have with this it might just be better to move from a hard fail to a best effort and go with:

        if let Err(e) = hwp.set_buffer_time_near(BUFFER_TIME.as_micros() as u32, ValueOr::Nearest) {
            warn!(
                "<AlsaSink> Failed to set buffer time, you may experience audio issues: {}",
                e
            );
        } else if let Err(e) =
            hwp.set_period_time_near(PERIOD_TIME.as_micros() as u32, ValueOr::Nearest)
        {
            warn!(
                "<AlsaSink> Failed to set period time, you may experience audio issues: {}",
                e
            );
        }
<!-- gh-comment-id:981243912 --> @JasonLG1979 commented on GitHub (Nov 29, 2021): To recap The device fails with both `snd_pcm_hw_params_set_buffer_time_near` and `snd_pcm_hw_params_set_buffer_size_near` there doesn't seem to be a way to set the buffer size on it? @roderickvd it always seems to be these little embedded devices or Kodi these days? I'm thinking with as much trouble as we have with this it might just be better to move from a hard fail to a best effort and go with: ```rust if let Err(e) = hwp.set_buffer_time_near(BUFFER_TIME.as_micros() as u32, ValueOr::Nearest) { warn!( "<AlsaSink> Failed to set buffer time, you may experience audio issues: {}", e ); } else if let Err(e) = hwp.set_period_time_near(PERIOD_TIME.as_micros() as u32, ValueOr::Nearest) { warn!( "<AlsaSink> Failed to set period time, you may experience audio issues: {}", e ); } ```
Author
Owner

@JasonLG1979 commented on GitHub (Nov 29, 2021):

@oebeledrijfhout Try this build:

https://drive.google.com/file/d/1IJDvD_iQOYCf0CNZFdQHVAZmrKiUjupp/view?usp=sharing

It's based on this branch:

https://github.com/JasonLG1979/librespot/tree/best-effort-buffer

It doesn't actually fix anything it just makes errors setting the buffer and period size non-fatal.

<!-- gh-comment-id:981257744 --> @JasonLG1979 commented on GitHub (Nov 29, 2021): @oebeledrijfhout Try this build: https://drive.google.com/file/d/1IJDvD_iQOYCf0CNZFdQHVAZmrKiUjupp/view?usp=sharing It's based on this branch: https://github.com/JasonLG1979/librespot/tree/best-effort-buffer It doesn't actually fix anything it just makes errors setting the buffer and period size non-fatal.
Author
Owner

@oebeledrijfhout commented on GitHub (Nov 29, 2021):

Thank you! I can confirm this allows me to playback, with a WARN in the log:

Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::player] == Starting sink ==
Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z WARN  librespot_playback::audio_backend::alsa] <AlsaSink> Failed to set buffer time, you may experience audio issues: ALSA function 'snd_pcm_hw_params_set_buffer_time_near' failed with error 'EINVAL: Invalid argument'
Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::audio_backend::alsa] Frames per Buffer: 65536
Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::audio_backend::alsa] Frames per Period: 256
Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::audio_backend::alsa] Period Buffer size in bytes: 2048
Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::audio_backend::alsa] Period Buffer capacity: 2048
<!-- gh-comment-id:981409081 --> @oebeledrijfhout commented on GitHub (Nov 29, 2021): Thank you! I can confirm this allows me to playback, with a `WARN` in the log: ``` Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::player] == Starting sink == Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z WARN librespot_playback::audio_backend::alsa] <AlsaSink> Failed to set buffer time, you may experience audio issues: ALSA function 'snd_pcm_hw_params_set_buffer_time_near' failed with error 'EINVAL: Invalid argument' Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::audio_backend::alsa] Frames per Buffer: 65536 Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::audio_backend::alsa] Frames per Period: 256 Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::audio_backend::alsa] Period Buffer size in bytes: 2048 Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::audio_backend::alsa] Period Buffer capacity: 2048 ```
Author
Owner

@roderickvd commented on GitHub (Nov 29, 2021):

I agree that the we should make a change. These all seem to be regressions from the (less optimal) way it was.

<!-- gh-comment-id:981409177 --> @roderickvd commented on GitHub (Nov 29, 2021): I agree that the we should make a change. These all seem to be regressions from the (less optimal) way it was.
Author
Owner

@JasonLG1979 commented on GitHub (Nov 29, 2021):

I agree that the we should make a change. These all seem to be regressions from the (less optimal) way it was.

OK, I'll combine the 2 solutions so that librespot will make a best effort to size the buffers within the reported min / max reported by alsa but if it fails it will just use the device's default.

<!-- gh-comment-id:981891411 --> @JasonLG1979 commented on GitHub (Nov 29, 2021): > I agree that the we should make a change. These all seem to be regressions from the (less optimal) way it was. OK, I'll combine the 2 solutions so that `librespot` will make a best effort to size the buffers within the reported min / max reported by alsa but if it fails it will just use the device's default.
Author
Owner

@JasonLG1979 commented on GitHub (Nov 29, 2021):

Thank you! I can confirm this allows me to playback, with a WARN in the log:

Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::player] == Starting sink ==
Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z WARN  librespot_playback::audio_backend::alsa] <AlsaSink> Failed to set buffer time, you may experience audio issues: ALSA function 'snd_pcm_hw_params_set_buffer_time_near' failed with error 'EINVAL: Invalid argument'
Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::audio_backend::alsa] Frames per Buffer: 65536
Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::audio_backend::alsa] Frames per Period: 256
Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::audio_backend::alsa] Period Buffer size in bytes: 2048
Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::audio_backend::alsa] Period Buffer capacity: 2048

Yep, unfortunately just like the warning says not being able to set a reasonable buffer size is not optimal and may result in high CPU usage, high latency, underruns and other audio issues.

In your case in particular your buffer is almost 1.5 secs long with extremely small period sizes. I wouldn't worry about underruns with that many periods in a buffer but with a buffer that large librespot may seem "laggy" and with periods that small you're sure to see higher CPU useage.

<!-- gh-comment-id:981897495 --> @JasonLG1979 commented on GitHub (Nov 29, 2021): > Thank you! I can confirm this allows me to playback, with a `WARN` in the log: > > ``` > Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::player] == Starting sink == > Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z WARN librespot_playback::audio_backend::alsa] <AlsaSink> Failed to set buffer time, you may experience audio issues: ALSA function 'snd_pcm_hw_params_set_buffer_time_near' failed with error 'EINVAL: Invalid argument' > Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::audio_backend::alsa] Frames per Buffer: 65536 > Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::audio_backend::alsa] Frames per Period: 256 > Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::audio_backend::alsa] Period Buffer size in bytes: 2048 > Nov 29 09:45:21 osmc0 librespot[8802]: [2021-11-29T08:45:21Z TRACE librespot_playback::audio_backend::alsa] Period Buffer capacity: 2048 > ``` Yep, unfortunately just like the warning says not being able to set a reasonable buffer size is not optimal and may result in high CPU usage, high latency, underruns and other audio issues. In your case in particular your buffer is almost 1.5 secs long with extremely small period sizes. I wouldn't worry about underruns with that many periods in a buffer but with a buffer that large `librespot` may seem "laggy" and with periods that small you're sure to see higher CPU useage.
Author
Owner

@JasonLG1979 commented on GitHub (Nov 29, 2021):

@oebeledrijfhout if all goes well with the PR that references this issue I will issue a new Raspotify release after it is merged.

<!-- gh-comment-id:982063187 --> @JasonLG1979 commented on GitHub (Nov 29, 2021): @oebeledrijfhout if all goes well with the PR that references this issue I will issue a new Raspotify release after it is merged.
Author
Owner

@JasonLG1979 commented on GitHub (Nov 29, 2021):

Here's a Raspotify build based on that branch:

https://drive.google.com/file/d/1uXvCve_kzjdrB3upC8rOaDgTLAsBvmdh/view?usp=sharing

See @roderickvd my evil plan of using Raspotify users as librespot testers is starting to bare fruit 😈 😆.

<!-- gh-comment-id:982083240 --> @JasonLG1979 commented on GitHub (Nov 29, 2021): Here's a Raspotify build based on that branch: https://drive.google.com/file/d/1uXvCve_kzjdrB3upC8rOaDgTLAsBvmdh/view?usp=sharing See @roderickvd my evil plan of using Raspotify users as `librespot` testers is starting to bare fruit :smiling_imp: :laughing:.
Author
Owner

@roderickvd commented on GitHub (Nov 29, 2021):

Good stuff. Would be nice if more would test #896. I'm actively working on #891, but on a Mac, and don't have access to my Alsa rig the coming few days.

<!-- gh-comment-id:982087892 --> @roderickvd commented on GitHub (Nov 29, 2021): Good stuff. Would be nice if more would test #896. I'm actively working on #891, but on a Mac, and don't have access to my Alsa rig the coming few days.
Author
Owner

@JasonLG1979 commented on GitHub (Nov 29, 2021):

Good stuff. Would be nice if more would test #896. I'm actively working on #891, but on a Mac, and don't have access to my Alsa rig the coming few days.

The intent (and so far the case in testing my devices) is that anyone who librespot works fine for now will notice nothing. But you know how quirky alsa can be. Worst case though you get the device's default buffer and period values which may not be ideal but IMHO it's better than a hard fail.

<!-- gh-comment-id:982092612 --> @JasonLG1979 commented on GitHub (Nov 29, 2021): > Good stuff. Would be nice if more would test #896. I'm actively working on #891, but on a Mac, and don't have access to my Alsa rig the coming few days. The intent (and so far the case in testing my devices) is that anyone who `librespot` works fine for now will notice nothing. But you know how quirky alsa can be. Worst case though you get the device's default buffer and period values which may not be ideal but IMHO it's better than a hard fail.
Author
Owner

@oebeledrijfhout commented on GitHub (Nov 29, 2021):

I installed that build and playback is working, with the same warning as with the previous build:

Nov 30 00:27:54 osmc0 systemd[1]: Started Raspotify (Spotify Connect Client).
Nov 30 00:27:54 osmc0 librespot[27128]: [2021-11-29T23:27:54Z INFO  librespot] librespot 0.3.1 7cdc7e3 (Built on 2021-11-29, Build ID: lU0YRhKm, Profile: release)
<...>
Nov 30 00:28:22 osmc0 librespot[27128]: [2021-11-29T23:28:22Z TRACE librespot_playback::player] == Starting sink ==
Nov 30 00:28:22 osmc0 librespot[27128]: [2021-11-29T23:28:22Z WARN  librespot_playback::audio_backend::alsa] <AlsaSink> Failed to set buffer size, you may experience audio issues.
Nov 30 00:28:23 osmc0 librespot[27128]: [2021-11-29T23:28:23Z TRACE librespot_playback::audio_backend::alsa] Buffer Frames: 65536
Nov 30 00:28:23 osmc0 librespot[27128]: [2021-11-29T23:28:23Z TRACE librespot_playback::audio_backend::alsa] Period Frames: 256
Nov 30 00:28:23 osmc0 librespot[27128]: [2021-11-29T23:28:23Z TRACE librespot_playback::audio_backend::alsa] Period Buffer size in bytes: 2048
Nov 30 00:28:23 osmc0 librespot[27128]: [2021-11-29T23:28:23Z TRACE librespot_playback::audio_backend::alsa] Period Buffer capacity: 2048

BTW, CPU usage is not looking excessive during playback.

<!-- gh-comment-id:982130045 --> @oebeledrijfhout commented on GitHub (Nov 29, 2021): I installed that build and playback is working, with the same warning as with the previous build: ``` Nov 30 00:27:54 osmc0 systemd[1]: Started Raspotify (Spotify Connect Client). Nov 30 00:27:54 osmc0 librespot[27128]: [2021-11-29T23:27:54Z INFO librespot] librespot 0.3.1 7cdc7e3 (Built on 2021-11-29, Build ID: lU0YRhKm, Profile: release) <...> Nov 30 00:28:22 osmc0 librespot[27128]: [2021-11-29T23:28:22Z TRACE librespot_playback::player] == Starting sink == Nov 30 00:28:22 osmc0 librespot[27128]: [2021-11-29T23:28:22Z WARN librespot_playback::audio_backend::alsa] <AlsaSink> Failed to set buffer size, you may experience audio issues. Nov 30 00:28:23 osmc0 librespot[27128]: [2021-11-29T23:28:23Z TRACE librespot_playback::audio_backend::alsa] Buffer Frames: 65536 Nov 30 00:28:23 osmc0 librespot[27128]: [2021-11-29T23:28:23Z TRACE librespot_playback::audio_backend::alsa] Period Frames: 256 Nov 30 00:28:23 osmc0 librespot[27128]: [2021-11-29T23:28:23Z TRACE librespot_playback::audio_backend::alsa] Period Buffer size in bytes: 2048 Nov 30 00:28:23 osmc0 librespot[27128]: [2021-11-29T23:28:23Z TRACE librespot_playback::audio_backend::alsa] Period Buffer capacity: 2048 ``` BTW, CPU usage is not looking excessive during playback.
Author
Owner

@JasonLG1979 commented on GitHub (Nov 30, 2021):

I installed that build and playback is working, with the same warning as with the previous build:

Yep, that's to be expected.

BTW, CPU usage is not looking excessive during playback.

It's normal for it to spike while it's initially caching the track but after that:

On a Pi Zero less than 20%.
On a Pi 4 around 5%.

I have no idea how the CPU ranks compared to either of those? But I'd imagine it's a lot closer to a Pi 4 than a Zero.

<!-- gh-comment-id:982145172 --> @JasonLG1979 commented on GitHub (Nov 30, 2021): > I installed that build and playback is working, with the same warning as with the previous build: Yep, that's to be expected. > BTW, CPU usage is not looking excessive during playback. It's normal for it to spike while it's initially caching the track but after that: On a Pi Zero less than 20%. On a Pi 4 around 5%. I have no idea how the CPU ranks compared to either of those? But I'd imagine it's a lot closer to a Pi 4 than a Zero.
Author
Owner

@JasonLG1979 commented on GitHub (Nov 30, 2021):

If it would help to test for anyone else I can build a one off amd64 Raspotify .deb. Just let me know.

<!-- gh-comment-id:982153787 --> @JasonLG1979 commented on GitHub (Nov 30, 2021): If it would help to test for anyone else I can build a one off `amd64` Raspotify .deb. Just let me know.
Author
Owner

@JasonLG1979 commented on GitHub (Dec 1, 2021):

@oebeledrijfhout hate to bug you again but I'm still trying to figure out the best way to handle dynamic buffer sizing and would very much appreciate you testing this out:

https://drive.google.com/file/d/1uxqJnj9PhiHgoupKbEspoNpLxOQ_-MTv/view?usp=sharing

<!-- gh-comment-id:984028961 --> @JasonLG1979 commented on GitHub (Dec 1, 2021): @oebeledrijfhout hate to bug you again but I'm still trying to figure out the best way to handle dynamic buffer sizing and would very much appreciate you testing this out: https://drive.google.com/file/d/1uxqJnj9PhiHgoupKbEspoNpLxOQ_-MTv/view?usp=sharing
Author
Owner

@JasonLG1979 commented on GitHub (Dec 1, 2021):

I've set the PR as a draft because with how quirky ALSA is you could test it on 20 different devices and get 20 different results, and I only have a few devices (all of which work with librespot before and after the PR). It needs a lot more testing.

<!-- gh-comment-id:984036378 --> @JasonLG1979 commented on GitHub (Dec 1, 2021): I've set the PR as a draft because with how quirky ALSA is you could test it on 20 different devices and get 20 different results, and I only have a few devices (all of which work with `librespot` before and after the PR). It needs a lot more testing.
Author
Owner

@roderickvd commented on GitHub (Dec 1, 2021):

I can test somewhere around the weekend. Maybe @jessicah can test too?

<!-- gh-comment-id:984038360 --> @roderickvd commented on GitHub (Dec 1, 2021): I can test somewhere around the weekend. Maybe @jessicah can test too?
Author
Owner

@oebeledrijfhout commented on GitHub (Dec 1, 2021):

@oebeledrijfhout hate to bug you again but I'm still trying to figure out the best way to handle dynamic buffer sizing and would very much appreciate you testing this out:

https://drive.google.com/file/d/1uxqJnj9PhiHgoupKbEspoNpLxOQ_-MTv/view?usp=sharing

No worries, glad to contribute. This build doesn't work on my device:

Dec 01 21:37:36 osmc0 librespot[13830]: [2021-12-01T20:37:36Z INFO  librespot] librespot 0.3.1 862c163 (Built on 2021-12-01, Build ID: 656zBuVk, Profile: release)
<...>
Dec 01 21:41:21 osmc0 librespot[13830]: [2021-12-01T20:41:21Z ERROR librespot_playback::player] Audio Sink Error Invalid Parameters: <AlsaSink> PCM, ALSA function 'snd_pcm_hw_params' failed with error 'EINVAL: Invalid argument'
Dec 01 21:41:21 osmc0 systemd[1]: raspotify.service: Main process exited, code=exited, status=1/FAILURE
<!-- gh-comment-id:984039128 --> @oebeledrijfhout commented on GitHub (Dec 1, 2021): > @oebeledrijfhout hate to bug you again but I'm still trying to figure out the best way to handle dynamic buffer sizing and would very much appreciate you testing this out: > > https://drive.google.com/file/d/1uxqJnj9PhiHgoupKbEspoNpLxOQ_-MTv/view?usp=sharing No worries, glad to contribute. This build doesn't work on my device: ``` Dec 01 21:37:36 osmc0 librespot[13830]: [2021-12-01T20:37:36Z INFO librespot] librespot 0.3.1 862c163 (Built on 2021-12-01, Build ID: 656zBuVk, Profile: release) <...> Dec 01 21:41:21 osmc0 librespot[13830]: [2021-12-01T20:41:21Z ERROR librespot_playback::player] Audio Sink Error Invalid Parameters: <AlsaSink> PCM, ALSA function 'snd_pcm_hw_params' failed with error 'EINVAL: Invalid argument' Dec 01 21:41:21 osmc0 systemd[1]: raspotify.service: Main process exited, code=exited, status=1/FAILURE ```
Author
Owner

@roderickvd commented on GitHub (Dec 1, 2021):

You can get it out of draft when you think the code is ready for review. No problem that it needs more testing after that. "Draft" to me means: I'm still at it, but know that this is on the way, and I welcome any input on-the-go.

<!-- gh-comment-id:984039427 --> @roderickvd commented on GitHub (Dec 1, 2021): You can get it out of draft when you think the code is ready for review. No problem that it needs more testing after that. "Draft" to me means: I'm still at it, but know that this is on the way, and I welcome any input on-the-go.
Author
Owner

@JasonLG1979 commented on GitHub (Dec 1, 2021):

What @oebeledrijfhout has shown me is that you can't brute force loop though a range of buffer values and call set_buffer_size_near or set_period_size_near.

I was hoping to be able to start high and just loop though and stop at an Ok. So much for that idea. It couldn't be that easy though ofc, it is ALSA after all,lol...

<!-- gh-comment-id:984061247 --> @JasonLG1979 commented on GitHub (Dec 1, 2021): What @oebeledrijfhout has shown me is that you can't brute force loop though a range of buffer values and call `set_buffer_size_near` or `set_period_size_near`. I was hoping to be able to start high and just loop though and stop at an `Ok`. So much for that idea. It couldn't be that easy though ofc, it is ALSA after all,lol...
Author
Owner

@JasonLG1979 commented on GitHub (Dec 2, 2021):

Ok @oebeledrijfhout round, I'm not even sure,lol!!!:

https://drive.google.com/file/d/1NQgwdd7brwe99uMGFfEaYRsUU09yyF9m/view?usp=sharing

This iteration is much like the previous working version except that I've moved the warning about not being able to set the buffer size to a trace message because I figure it's just log noise if someone's not actually having audible issues and if they were hopefully they would file an issue and provide some verbose output. I also added some trace messages to help debug in the case of an issue.

<!-- gh-comment-id:984261157 --> @JasonLG1979 commented on GitHub (Dec 2, 2021): Ok @oebeledrijfhout round, I'm not even sure,lol!!!: https://drive.google.com/file/d/1NQgwdd7brwe99uMGFfEaYRsUU09yyF9m/view?usp=sharing This iteration is much like the previous working version except that I've moved the warning about not being able to set the buffer size to a trace message because I figure it's just log noise if someone's not actually having audible issues and if they were hopefully they would file an issue and provide some verbose output. I also added some trace messages to help debug in the case of an issue.
Author
Owner

@JasonLG1979 commented on GitHub (Dec 2, 2021):

You should see something like this:

Desired Buffer Frame range: 4410 - 22050
Buffer Frame range reported by device: 64 - 65536
Desired Period Frame range: 2205 - 5512
Period Frame range reported by device: 35 - 11025
Frames per Buffer: 22050
Frames per Period: 4410
<!-- gh-comment-id:984271678 --> @JasonLG1979 commented on GitHub (Dec 2, 2021): You should see something like this: ``` Desired Buffer Frame range: 4410 - 22050 Buffer Frame range reported by device: 64 - 65536 Desired Period Frame range: 2205 - 5512 Period Frame range reported by device: 35 - 11025 Frames per Buffer: 22050 Frames per Period: 4410 ```
Author
Owner

@oebeledrijfhout commented on GitHub (Dec 2, 2021):

looks (and sounds) good!

Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::player] == Starting sink ==
Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Desired Buffer Frame range: 4410 - 22050
Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Buffer Frame range reported by device: 16 - 65536
Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Desired Period Frame range: 0 - 0
Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Period Frame range reported by device: 32 - 8192
Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Failed to set buffer size, falling back to the device's defaults.
Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Frames per Buffer: 65536
Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Frames per Period: 256
Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Period Buffer size in bytes: 2048
Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Period Buffer capacity: 2048
<!-- gh-comment-id:984588982 --> @oebeledrijfhout commented on GitHub (Dec 2, 2021): looks (and sounds) good! ``` Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::player] == Starting sink == Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Desired Buffer Frame range: 4410 - 22050 Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Buffer Frame range reported by device: 16 - 65536 Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Desired Period Frame range: 0 - 0 Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Period Frame range reported by device: 32 - 8192 Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Failed to set buffer size, falling back to the device's defaults. Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Frames per Buffer: 65536 Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Frames per Period: 256 Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Period Buffer size in bytes: 2048 Dec 02 13:34:26 osmc0 librespot[27221]: [2021-12-02T12:34:26Z TRACE librespot_playback::audio_backend::alsa] Period Buffer capacity: 2048 ```
Author
Owner

@JasonLG1979 commented on GitHub (Dec 2, 2021):

Weird that it reports an available buffer size range of 16 - 65536 Frames and then totally fails when librespot tries to set the buffer to 22050 Frames which is obviously in that range. That's clearly a driver/configuration bug. The expected result of calling snd_pcm_hw_params_set_buffer_size_near (and the rust bindings) would be for it to return what the driver set the buffer size to be (hopefully something close to what you asked for). You should basically be able to pass any Frame value to that function and it should never fail. The fact that it always fails is very, very broken. I would file a bug report upstream and tell them to fix their shit drivers/configuration.

<!-- gh-comment-id:984795410 --> @JasonLG1979 commented on GitHub (Dec 2, 2021): Weird that it reports an available buffer size range of `16 - 65536` Frames and then totally fails when `librespot` tries to set the buffer to `22050` Frames which is obviously in that range. That's clearly a driver/configuration bug. The expected result of calling [`snd_pcm_hw_params_set_buffer_size_near`](https://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m___h_w___params.html#ga2c00cb635d374030595dbc27b7a983a7) ([and the rust bindings](https://docs.rs/alsa/latest/src/alsa/pcm.rs.html#741-744)) would be for it to return what the driver set the buffer size to be (hopefully something close to what you asked for). You should basically be able to pass any Frame value to that function and it should never fail. The fact that it always fails is very, very broken. I would file a bug report upstream and tell them to fix their shit drivers/configuration.
Author
Owner

@JasonLG1979 commented on GitHub (Dec 2, 2021):

I'm glad however that we've figured out a workaround.

<!-- gh-comment-id:984798261 --> @JasonLG1979 commented on GitHub (Dec 2, 2021): I'm glad however that we've figured out a workaround.
Author
Owner

@JasonLG1979 commented on GitHub (Dec 2, 2021):

I can test somewhere around the weekend. Maybe @jessicah can test too?

I think they have ghosted us. It must not have been that important to them? But just in case here is an amd64 binary I compiled on my Ubuntu 21.10 box built with --release --no-default-features --features alsa-backend

https://drive.google.com/file/d/1oZ45gch7XKTrDi54UemIfvXRenTHQsHb/view?usp=sharing

<!-- gh-comment-id:984976348 --> @JasonLG1979 commented on GitHub (Dec 2, 2021): > I can test somewhere around the weekend. Maybe @jessicah can test too? I think they have ghosted us. It must not have been that important to them? But just in case here is an amd64 binary I compiled on my Ubuntu 21.10 box built with `--release --no-default-features --features alsa-backend` https://drive.google.com/file/d/1oZ45gch7XKTrDi54UemIfvXRenTHQsHb/view?usp=sharing
Author
Owner

@sarlej commented on GitHub (Dec 2, 2021):

On my Vero4k (OSMC) version: raspotify_0.31.3-4-g8d41bd0-dirty~librespot.v0.2.0-150-gc737337_armhf.deb fixed my issue (same as @oebeledrijfhout posted originally).
I don't have any complains about set buffer size, but i'm using external USB sound card.

[2021-12-02T21:23:47Z TRACE librespot_playback::player] == Starting sink ==
[2021-12-02T21:23:47Z TRACE librespot_playback::audio_backend::alsa] Desired Buffer Frame range: 4410 - 22050
[2021-12-02T21:23:47Z TRACE librespot_playback::audio_backend::alsa] Buffer Frame range reported by device: 90 - 262144
[2021-12-02T21:23:47Z TRACE librespot_playback::audio_backend::alsa] Desired Period Frame range: 2205 - 5512
[2021-12-02T21:23:47Z TRACE librespot_playback::audio_backend::alsa] Period Frame range reported by device: 45 - 11025
[2021-12-02T21:23:47Z TRACE librespot_playback::audio_backend::alsa] Frames per Buffer: 22050
[2021-12-02T21:23:47Z TRACE librespot_playback::audio_backend::alsa] Frames per Period: 5512
[2021-12-02T21:23:47Z TRACE librespot_playback::audio_backend::alsa] Period Buffer size in bytes: 22048
[2021-12-02T21:23:47Z TRACE librespot_playback::audio_backend::alsa] Period Buffer capacity: 22048
<!-- gh-comment-id:985025529 --> @sarlej commented on GitHub (Dec 2, 2021): On my Vero4k (OSMC) version: `raspotify_0.31.3-4-g8d41bd0-dirty~librespot.v0.2.0-150-gc737337_armhf.deb` fixed my issue (same as @oebeledrijfhout posted originally). I don't have any complains about set buffer size, but i'm using external USB sound card. ``` [2021-12-02T21:23:47Z TRACE librespot_playback::player] == Starting sink == [2021-12-02T21:23:47Z TRACE librespot_playback::audio_backend::alsa] Desired Buffer Frame range: 4410 - 22050 [2021-12-02T21:23:47Z TRACE librespot_playback::audio_backend::alsa] Buffer Frame range reported by device: 90 - 262144 [2021-12-02T21:23:47Z TRACE librespot_playback::audio_backend::alsa] Desired Period Frame range: 2205 - 5512 [2021-12-02T21:23:47Z TRACE librespot_playback::audio_backend::alsa] Period Frame range reported by device: 45 - 11025 [2021-12-02T21:23:47Z TRACE librespot_playback::audio_backend::alsa] Frames per Buffer: 22050 [2021-12-02T21:23:47Z TRACE librespot_playback::audio_backend::alsa] Frames per Period: 5512 [2021-12-02T21:23:47Z TRACE librespot_playback::audio_backend::alsa] Period Buffer size in bytes: 22048 [2021-12-02T21:23:47Z TRACE librespot_playback::audio_backend::alsa] Period Buffer capacity: 22048 ```
Author
Owner

@JasonLG1979 commented on GitHub (Dec 2, 2021):

@sarlej that's weird that you had an issue? Judging by your output librespot has no trouble setting the buffer or period size?

It shows that librespot got both it's desired buffer and period size (22050 and 5512) which is as you'd hope it would be?

Maybe it's a distro specific issue?

In any event I'm glad if it solves whatever issue you may have been having? And thank you for testing.

<!-- gh-comment-id:985032013 --> @JasonLG1979 commented on GitHub (Dec 2, 2021): @sarlej that's weird that you had an issue? Judging by your output `librespot` has no trouble setting the buffer or period size? It shows that `librespot` got both it's desired buffer and period size (`22050` and `5512`) which is as you'd hope it would be? Maybe it's a distro specific issue? In any event I'm glad if it solves whatever issue you may have been having? And thank you for testing.
Author
Owner

@JasonLG1979 commented on GitHub (Dec 2, 2021):

I'd really have to look at their default audio configs to see if they're doing something screwy. They are basically an appliance distro running on what is intended to be an appliance type device, maybe they've changed things to suit there own particular needs at the expense of others?

<!-- gh-comment-id:985035298 --> @JasonLG1979 commented on GitHub (Dec 2, 2021): I'd really have to look at their default audio configs to see if they're doing something screwy. They are basically an appliance distro running on what is intended to be an appliance type device, maybe they've changed things to suit there own particular needs at the expense of others?
Author
Owner

@sarlej commented on GitHub (Dec 3, 2021):

@JasonLG1979 it looks like it was exactly same issue as @oebeledrijfhout had. I try to reproduce the error and it looks like i didn't configure external USB sound card, so it used internal one. Sorry for mystification.
Nevertheless the update fix the problem when using internal card and log is same as @oebeledrijfhout posted.

[2021-12-03T07:26:12Z TRACE librespot_playback::player] == Starting sink ==
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Desired Buffer Frame range: 4410 - 22050
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Buffer Frame range reported by device: 32 - 131072
[2021-12-03T07:26:12Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPlay]
[2021-12-03T07:26:12Z TRACE librespot_connect::spirc] ==> kPlayStatusPlay
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Desired Period Frame range: 0 - 0
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Period Frame range reported by device: 32 - 16384
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Failed to set buffer size, falling back to the device's defaults.
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Frames per Buffer: 131072
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Frames per Period: 256
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Period Buffer size in bytes: 1024
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Period Buffer capacity: 1024
<!-- gh-comment-id:985280080 --> @sarlej commented on GitHub (Dec 3, 2021): @JasonLG1979 it looks like it was exactly same issue as @oebeledrijfhout had. I try to reproduce the error and it looks like i didn't configure external USB sound card, so it used internal one. Sorry for mystification. Nevertheless the update fix the problem when using internal card and log is same as @oebeledrijfhout posted. ``` [2021-12-03T07:26:12Z TRACE librespot_playback::player] == Starting sink == [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Desired Buffer Frame range: 4410 - 22050 [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Buffer Frame range reported by device: 32 - 131072 [2021-12-03T07:26:12Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPlay] [2021-12-03T07:26:12Z TRACE librespot_connect::spirc] ==> kPlayStatusPlay [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Desired Period Frame range: 0 - 0 [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Period Frame range reported by device: 32 - 16384 [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Failed to set buffer size, falling back to the device's defaults. [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Frames per Buffer: 131072 [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Frames per Period: 256 [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Period Buffer size in bytes: 1024 [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Period Buffer capacity: 1024 ```
Author
Owner

@JasonLG1979 commented on GitHub (Dec 3, 2021):

@JasonLG1979 it looks like it was exactly same issue as @oebeledrijfhout had. I try to reproduce the error and it looks like i didn't configure external USB sound card, so it used internal one. Sorry for mystification. Nevertheless the update fix the problem when using internal card and log is same as @oebeledrijfhout posted.

[2021-12-03T07:26:12Z TRACE librespot_playback::player] == Starting sink ==
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Desired Buffer Frame range: 4410 - 22050
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Buffer Frame range reported by device: 32 - 131072
[2021-12-03T07:26:12Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPlay]
[2021-12-03T07:26:12Z TRACE librespot_connect::spirc] ==> kPlayStatusPlay
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Desired Period Frame range: 0 - 0
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Period Frame range reported by device: 32 - 16384
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Failed to set buffer size, falling back to the device's defaults.
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Frames per Buffer: 131072
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Frames per Period: 256
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Period Buffer size in bytes: 1024
[2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Period Buffer capacity: 1024

Ok, that makes more sense. Then I guess it's a double confirmation. The fix also worked for you on the affected device and it was not detrimental on a well behaved device (which is also very important) thank you for the clarification.

<!-- gh-comment-id:985592415 --> @JasonLG1979 commented on GitHub (Dec 3, 2021): > @JasonLG1979 it looks like it was exactly same issue as @oebeledrijfhout had. I try to reproduce the error and it looks like i didn't configure external USB sound card, so it used internal one. Sorry for mystification. Nevertheless the update fix the problem when using internal card and log is same as @oebeledrijfhout posted. > > ``` > [2021-12-03T07:26:12Z TRACE librespot_playback::player] == Starting sink == > [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Desired Buffer Frame range: 4410 - 22050 > [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Buffer Frame range reported by device: 32 - 131072 > [2021-12-03T07:26:12Z TRACE librespot_connect::spirc] Sending status to server: [kPlayStatusPlay] > [2021-12-03T07:26:12Z TRACE librespot_connect::spirc] ==> kPlayStatusPlay > [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Desired Period Frame range: 0 - 0 > [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Period Frame range reported by device: 32 - 16384 > [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Failed to set buffer size, falling back to the device's defaults. > [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Frames per Buffer: 131072 > [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Frames per Period: 256 > [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Period Buffer size in bytes: 1024 > [2021-12-03T07:26:12Z TRACE librespot_playback::audio_backend::alsa] Period Buffer capacity: 1024 > ``` Ok, that makes more sense. Then I guess it's a double confirmation. The fix also worked for you on the affected device and it was not detrimental on a well behaved device (which is also very important) thank you for the clarification.
Author
Owner

@JasonLG1979 commented on GitHub (Dec 3, 2021):

@roderickvd I'm going to take the PR out of draft mode since I think the proof of concept is proven. It's really just a matter of further testing and review. I've pushed another commit since I posted those binaries but it didn't change the functionality of the PR. It was mostly just about sprinkling in trace messages to help with future debugging so results from the posted binaries are still applicable.

<!-- gh-comment-id:985760632 --> @JasonLG1979 commented on GitHub (Dec 3, 2021): @roderickvd I'm going to take the PR out of draft mode since I think the proof of concept is proven. It's really just a matter of further testing and review. I've pushed another commit since I posted those binaries but it didn't change the functionality of the PR. It was mostly just about sprinkling in trace messages to help with future debugging so results from the posted binaries are still applicable.
Author
Owner

@roderickvd commented on GitHub (Dec 3, 2021):

Thanks for that work. I'll take some time to test it on my rig this weekend and get it merged. Then when it lives in dev it can get some proper exposure before we release a new version.

<!-- gh-comment-id:985766235 --> @roderickvd commented on GitHub (Dec 3, 2021): Thanks for that work. I'll take some time to test it on my rig this weekend and get it merged. Then when it lives in `dev` it can get some proper exposure before we release a new version.
Author
Owner

@JasonLG1979 commented on GitHub (Dec 3, 2021):

In a perfect world of sensible APIs, well behaved devices and logical configurations none of it would be necessary. But as we both know from experience ALSA is not sensible, devices are rarely well behaved and configurations tend to be illogical,lol!!!

<!-- gh-comment-id:985770677 --> @JasonLG1979 commented on GitHub (Dec 3, 2021): In a perfect world of sensible APIs, well behaved devices and logical configurations none of it would be necessary. But as we both know from experience ALSA is not sensible, devices are rarely well behaved and configurations tend to be illogical,lol!!!
Author
Owner

@JasonLG1979 commented on GitHub (Dec 3, 2021):

As soon as it hits dev I will ship it in Raspotify. It should be plenty of exposure there.

<!-- gh-comment-id:985772137 --> @JasonLG1979 commented on GitHub (Dec 3, 2021): As soon as it hits dev I will ship it in Raspotify. It should be plenty of exposure there.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#443
No description provided.