Skip to content

Commit 62ba568

Browse files
psqlitiwai
authored andcommitted
ALSA: pcm: Return 0 when size < start_threshold in capture
In __snd_pcm_lib_xfer(), when capture, if state is PREPARED and size is less than start_threshold nothing can be done. As there is no error, 0 is returned. Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 5b394b2 commit 62ba568

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

sound/core/pcm_lib.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2173,11 +2173,16 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
21732173
goto _end_unlock;
21742174

21752175
if (!is_playback &&
2176-
runtime->status->state == SNDRV_PCM_STATE_PREPARED &&
2177-
size >= runtime->start_threshold) {
2178-
err = snd_pcm_start(substream);
2179-
if (err < 0)
2176+
runtime->status->state == SNDRV_PCM_STATE_PREPARED) {
2177+
if (size >= runtime->start_threshold) {
2178+
err = snd_pcm_start(substream);
2179+
if (err < 0)
2180+
goto _end_unlock;
2181+
} else {
2182+
/* nothing to do */
2183+
err = 0;
21802184
goto _end_unlock;
2185+
}
21812186
}
21822187

21832188
runtime->twake = runtime->control->avail_min ? : 1;

0 commit comments

Comments
 (0)