ALSA: pcm: Fix avail to return error if stream is suspended
PATCH 1/1 ALSA: pcm: Fix avail to return error if stream is suspended
From: Jeeja KP <[email protected]>
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.
--- sound/core/pcm_native.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/core/pcm_native.c +3 -1
@@ -2637,9 +2637,11 @@ static int snd_pcm_hwsync(struct snd_pcm_substream *substream)break ;/* Fall through */ case SNDRV_PCM_STATE_PREPARED : -case SNDRV_PCM_STATE_SUSPENDED : err =0 ;break ; +case SNDRV_PCM_STATE_SUSPENDED : + err = -ESTRPIPE ; +break ;case SNDRV_PCM_STATE_XRUN : err = -EPIPE ;break ;
Signature · 1 line
2.5.0
Takashi Iwai
AppliedQuoted 11 lines · On Fri, 02 Sep 2016 18:19:44 +0200, [email protected] wrote:
From: Jeeja KP <[email protected]>
When the stream is in suspended state some applications wait on "Stream Pipe Error" in response to
snd_pcm_availcall 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.
Quoted 5 lines
"Stream pipe Error" code is getting returned for read/write call when the stream is in suspended state. Similarly update
snd_pcm_availto return-ESTRPIPE.Signed-off-by Jeeja KP <[email protected]>
Applied, thanks.
Takashi
Quoted 29 lines
--- sound/core/pcm_native.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)sound/core/pcm_native.c +3
-1@@ -2637,9 +2637,11 @@ static int snd_pcm_hwsync(struct snd_pcm_substream *substream)break ;/* Fall through */ case SNDRV_PCM_STATE_PREPARED : -case SNDRV_PCM_STATE_SUSPENDED : err =0 ;break ; +case SNDRV_PCM_STATE_SUSPENDED : + err = -ESTRPIPE ; +break ;case SNDRV_PCM_STATE_XRUN : err = -EPIPE ;break ;Signature · 6 lines
2.5.0 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel