From 811c2ce69d1265ace42a05ef045ca1b4ed72e01c Mon Sep 17 00:00:00 2001
From: argothiel <argothiel_alsa@interia.pl>
Date: Mon, 21 Sep 2026 02:11:52 +0200
Subject: [PATCH] Fix latency error check in pulse_delay()

There is 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`.

Change `PA_ERR_NODATA` to `-PA_ERR_NODATA` in the comparison to not miss
that branch.

Fixes #65.

Closes: https://github.com/alsa-project/alsa-plugins/pull/67
Signed-off-by: argothiel <argothiel_alsa@interia.pl>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
 pulse/pcm_pulse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pulse/pcm_pulse.c b/pulse/pcm_pulse.c
index a201bf9..e05eaa5 100644
--- a/pulse/pcm_pulse.c
+++ b/pulse/pcm_pulse.c
@@ -396,7 +396,7 @@ static int pulse_delay(snd_pcm_ioplug_t * io, snd_pcm_sframes_t * delayp)
 
 		err = pa_stream_get_latency(pcm->stream, &lat, NULL);
 		if (err) {
-			if (err != PA_ERR_NODATA) {
+			if (err != -PA_ERR_NODATA) {
 				err = -EIO;
 				goto finish;
 			}
