Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* ALSA Pulse plugin returns -EIO from snd_pcm_avail_delay() in case of -PA_ERR_NODATA
       [not found] <18d72d6ada085a00-webhooks-bot@alsa-project.org>
@ 2026-09-21  0:08 ` GitHub issues - opened
  0 siblings, 0 replies; 3+ messages in thread
From: GitHub issues - opened @ 2026-09-21  0:08 UTC (permalink / raw)
  To: alsa-devel

alsa-project/alsa-plugins issue #65 was opened from argothiel:

### Environment

- Ubuntu 26.04 under WSL2 / WSLg
- `libasound2-plugins` 1.2.12-2build1
- PulseAudio server available through WSLg

### Problem

Immediately after configuring a playback PCM opened through the ALSA `pulse` plugin, `snd_pcm_avail_delay()` returns `-EIO`. This seems to be an issue with `pulse_delay()` which calls `pa_stream_get_latency()`. PulseAudio documents that this function returns `-PA_ERR_NODATA` when timing information is not available yet. The ALSA Pulse plugin compares the result against positive `PA_ERR_NODATA`; it therefore treats that temporary condition as an unrelated failure and returns `-EIO`:
- ALSA Pulse plugin comparison:
  https://github.com/alsa-project/alsa-plugins/blob/ffc8b900792b77764213bac6816ba60f2c8d8025/pulse/pcm_pulse.c#L397-L404
- PulseAudio `pa_stream_get_latency()` documentation:
  https://github.com/pulseaudio/pulseaudio/blob/77d25a1e613095bdf87a1d13b65e7c330565077a/src/pulse/stream.h#L721-L726
- The same issue has been fixed in the `shairport-sync` version:
  https://github.com/mikebrady/shairport-sync/pull/2119

### Reproducer

```c
#include <alsa/asoundlib.h>
#include <assert.h>
#include <stdio.h>

int main(void)
{
    snd_pcm_t *pcm;
    snd_pcm_sframes_t avail, delay;
    int err;

    err = snd_pcm_open(&pcm, "pulse", SND_PCM_STREAM_PLAYBACK, 0);
    assert(err == 0);

    err = snd_pcm_set_params(
        pcm,
        SND_PCM_FORMAT_FLOAT_LE,
        SND_PCM_ACCESS_RW_INTERLEAVED,
        2,
        48000,
        1,
        20000);
    assert(err == 0);

    err = snd_pcm_avail_delay(pcm, &avail, &delay);
    printf("snd_pcm_avail_delay: %s (%d)\n", snd_strerror(err), err);

    snd_pcm_close(pcm);
    return err < 0;
}
```

Build and run:
```sh
cc main.c -lasound && ./a.out
```

### Actual result

```sh
snd_pcm_avail_delay: Input/output error (-5)
```

### Expected result

`snd_pcm_avail_delay()` should return the available-frame and delay values, or a more specific recoverable error if latency information is temporarily unavailable.

Issue URL     : https://github.com/alsa-project/alsa-plugins/issues/65
Repository URL: https://github.com/alsa-project/alsa-plugins

^ permalink raw reply	[flat|nested] 3+ messages in thread

* ALSA Pulse plugin returns -EIO from snd_pcm_avail_delay() in case of -PA_ERR_NODATA
       [not found] <18d72dce2a4a3b00-webhooks-bot@alsa-project.org>
@ 2026-09-21  0:15 ` GitHub issues - edited
  0 siblings, 0 replies; 3+ messages in thread
From: GitHub issues - edited @ 2026-09-21  0:15 UTC (permalink / raw)
  To: alsa-devel

alsa-project/alsa-plugins issue #65 was edited from argothiel:

### Environment

- Ubuntu 26.04 under WSL2 / WSLg
- `libasound2-plugins` 1.2.12-2build1
- PulseAudio server available through WSLg

### Problem

Immediately after configuring a playback PCM opened through the ALSA `pulse` plugin, `snd_pcm_avail_delay()` returns `-EIO`. This seems to be an issue with `pulse_delay()` which calls `pa_stream_get_latency()`. PulseAudio documents that this function returns `-PA_ERR_NODATA` when timing information is not available yet. The ALSA Pulse plugin compares the result against positive `PA_ERR_NODATA`; it therefore treats that temporary condition as an unrelated failure and returns `-EIO`:
- ALSA Pulse plugin comparison:
  https://github.com/alsa-project/alsa-plugins/blob/ffc8b900792b77764213bac6816ba60f2c8d8025/pulse/pcm_pulse.c#L397-L404
- PulseAudio `pa_stream_get_latency()` documentation:
  https://github.com/pulseaudio/pulseaudio/blob/77d25a1e613095bdf87a1d13b65e7c330565077a/src/pulse/stream.h#L721-L726
- The same issue has been fixed in the `shairport-sync` version:
  https://github.com/mikebrady/shairport-sync/pull/2119

### Reproducer

```c
#include <alsa/asoundlib.h>
#include <assert.h>
#include <stdio.h>

int main(void)
{
    snd_pcm_t *pcm;
    snd_pcm_sframes_t avail, delay;
    int err;

    err = snd_pcm_open(&pcm, "pulse", SND_PCM_STREAM_PLAYBACK, 0);
    assert(err == 0);

    err = snd_pcm_set_params(
        pcm,
        SND_PCM_FORMAT_FLOAT_LE,
        SND_PCM_ACCESS_RW_INTERLEAVED,
        2,
        48000,
        1,
        20000);
    assert(err == 0);

    err = snd_pcm_avail_delay(pcm, &avail, &delay);
    printf("snd_pcm_avail_delay: %s (%d)\n", snd_strerror(err), err);

    snd_pcm_close(pcm);
    return err < 0;
}
```

Build and run:
```sh
cc main.c -lasound && ./a.out
```

### Actual result

```sh
snd_pcm_avail_delay: Input/output error (-5)
```

### Expected result

`snd_pcm_avail_delay()` should wait until PulseAudio timing information is available, then return the available-frame and delay values.

Issue URL     : https://github.com/alsa-project/alsa-plugins/issues/65
Repository URL: https://github.com/alsa-project/alsa-plugins

^ permalink raw reply	[flat|nested] 3+ messages in thread

* ALSA Pulse plugin returns -EIO from snd_pcm_avail_delay() in case of -PA_ERR_NODATA
       [not found] <18d72e16c7535000-webhooks-bot@alsa-project.org>
@ 2026-09-21  0:20 ` GitHub issues - edited
  0 siblings, 0 replies; 3+ messages in thread
From: GitHub issues - edited @ 2026-09-21  0:20 UTC (permalink / raw)
  To: alsa-devel

alsa-project/alsa-plugins issue #65 was edited from argothiel:

### Environment

- Ubuntu 26.04 under WSL2 / WSLg
- `libasound2-plugins` 1.2.12-2build1
- PulseAudio server available through WSLg

### Problem

Immediately after configuring a playback PCM opened through the ALSA `pulse` plugin, `snd_pcm_avail_delay()` returns `-EIO`. This seems to be an issue with `pulse_delay()` which calls `pa_stream_get_latency()`. PulseAudio documents that this function returns `-PA_ERR_NODATA` when timing information is not available yet. The ALSA Pulse plugin compares the result against positive `PA_ERR_NODATA`; it therefore treats that temporary condition as an unrelated failure and returns `-EIO`:
- ALSA Pulse plugin comparison:
  https://github.com/alsa-project/alsa-plugins/blob/ffc8b900792b77764213bac6816ba60f2c8d8025/pulse/pcm_pulse.c#L397-L404
- PulseAudio `pa_stream_get_latency()` documentation:
  https://github.com/pulseaudio/pulseaudio/blob/77d25a1e613095bdf87a1d13b65e7c330565077a/src/pulse/stream.h#L725-L726
- The same issue has been fixed in the `shairport-sync` version:
  https://github.com/mikebrady/shairport-sync/pull/2119

### Reproducer

```c
#include <alsa/asoundlib.h>
#include <assert.h>
#include <stdio.h>

int main(void)
{
    snd_pcm_t *pcm;
    snd_pcm_sframes_t avail, delay;
    int err;

    err = snd_pcm_open(&pcm, "pulse", SND_PCM_STREAM_PLAYBACK, 0);
    assert(err == 0);

    err = snd_pcm_set_params(
        pcm,
        SND_PCM_FORMAT_FLOAT_LE,
        SND_PCM_ACCESS_RW_INTERLEAVED,
        2,
        48000,
        1,
        20000);
    assert(err == 0);

    err = snd_pcm_avail_delay(pcm, &avail, &delay);
    printf("snd_pcm_avail_delay: %s (%d)\n", snd_strerror(err), err);

    snd_pcm_close(pcm);
    return err < 0;
}
```

Build and run:
```sh
cc main.c -lasound && ./a.out
```

### Actual result

```sh
snd_pcm_avail_delay: Input/output error (-5)
```

### Expected result

`snd_pcm_avail_delay()` should wait until PulseAudio timing information is available, then return the available-frame and delay values.

Issue URL     : https://github.com/alsa-project/alsa-plugins/issues/65
Repository URL: https://github.com/alsa-project/alsa-plugins

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-21  0:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <18d72d6ada085a00-webhooks-bot@alsa-project.org>
2026-09-21  0:08 ` ALSA Pulse plugin returns -EIO from snd_pcm_avail_delay() in case of -PA_ERR_NODATA GitHub issues - opened
     [not found] <18d72dce2a4a3b00-webhooks-bot@alsa-project.org>
2026-09-21  0:15 ` GitHub issues - edited
     [not found] <18d72e16c7535000-webhooks-bot@alsa-project.org>
2026-09-21  0:20 ` GitHub issues - edited

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox