Skip to content

Commit

Permalink
ALSA: pcm: Return 0 when size < start_threshold in capture
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
psqli authored and tiwai committed Aug 27, 2018
1 parent 5b394b2 commit 62ba568
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions sound/core/pcm_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2173,11 +2173,16 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
goto _end_unlock;

if (!is_playback &&
runtime->status->state == SNDRV_PCM_STATE_PREPARED &&
size >= runtime->start_threshold) {
err = snd_pcm_start(substream);
if (err < 0)
runtime->status->state == SNDRV_PCM_STATE_PREPARED) {
if (size >= runtime->start_threshold) {
err = snd_pcm_start(substream);
if (err < 0)
goto _end_unlock;
} else {
/* nothing to do */
err = 0;
goto _end_unlock;
}
}

runtime->twake = runtime->control->avail_min ? : 1;
Expand Down

0 comments on commit 62ba568

Please sign in to comment.