Skip to content

Commit f3f6c61

Browse files
kpjeejatiwai
authored andcommitted
ALSA: pcm: Fix avail to return error if stream is suspended
When the stream is in suspended state some applications wait on "Stream Pipe Error" in response to snd_pcm_avail call to resume the stream. In the current implementation snd_pcm_avail() returns zero when the stream is in suspended state. This causes application to enter in infinite loop for frames to be available. "Stream pipe Error" code is getting returned for read/write call when the stream is in suspended state. Similarly update snd_pcm_avail to return -ESTRPIPE. Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 8c91d7d commit f3f6c61

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎sound/core/pcm_native.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2637,9 +2637,11 @@ static int snd_pcm_hwsync(struct snd_pcm_substream *substream)
26372637
break;
26382638
/* Fall through */
26392639
case SNDRV_PCM_STATE_PREPARED:
2640-
case SNDRV_PCM_STATE_SUSPENDED:
26412640
err = 0;
26422641
break;
2642+
case SNDRV_PCM_STATE_SUSPENDED:
2643+
err = -ESTRPIPE;
2644+
break;
26432645
case SNDRV_PCM_STATE_XRUN:
26442646
err = -EPIPE;
26452647
break;

0 commit comments

Comments
 (0)