Skip to content

Commit 3b81799

Browse files
charleskeepaxtiwai
authored andcommitted
ALSA: compress: Be more restrictive about when a drain is allowed
Draining makes little sense in the situation of hardware overrun, as the hardware will have consumed all its available samples. Additionally, draining whilst the stream is paused would presumably get stuck as no data is being consumed on the DSP side. Signed-off-by: Charles Keepax <[email protected]> Acked-by: Vinod Koul <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent a70ab8a commit 3b81799

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sound/core/compress_offload.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,10 @@ static int snd_compr_drain(struct snd_compr_stream *stream)
811811
case SNDRV_PCM_STATE_OPEN:
812812
case SNDRV_PCM_STATE_SETUP:
813813
case SNDRV_PCM_STATE_PREPARED:
814+
case SNDRV_PCM_STATE_PAUSED:
814815
return -EPERM;
816+
case SNDRV_PCM_STATE_XRUN:
817+
return -EPIPE;
815818
default:
816819
break;
817820
}
@@ -860,7 +863,10 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream)
860863
case SNDRV_PCM_STATE_OPEN:
861864
case SNDRV_PCM_STATE_SETUP:
862865
case SNDRV_PCM_STATE_PREPARED:
866+
case SNDRV_PCM_STATE_PAUSED:
863867
return -EPERM;
868+
case SNDRV_PCM_STATE_XRUN:
869+
return -EPIPE;
864870
default:
865871
break;
866872
}

0 commit comments

Comments
 (0)