Skip to content
Snippets Groups Projects
Commit 64b6acf6 authored by Ricardo Biehl Pasquali's avatar Ricardo Biehl Pasquali Committed by Takashi Iwai
Browse files

ALSA: pcm: Update hardware pointer before start capture


This ensures the transfer loop won't waste a run to read
the few frames (if any) between start and hw_ptr update.
It will wait for the next interrupt with wait_for_avail().

Signed-off-by: default avatarRicardo Biehl Pasquali <pasqualirb@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 70f7922c
No related branches found
No related tags found
No related merge requests found
...@@ -2172,6 +2172,10 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, ...@@ -2172,6 +2172,10 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
if (err < 0) if (err < 0)
goto _end_unlock; goto _end_unlock;
runtime->twake = runtime->control->avail_min ? : 1;
if (runtime->status->state == SNDRV_PCM_STATE_RUNNING)
snd_pcm_update_hw_ptr(substream);
if (!is_playback && if (!is_playback &&
runtime->status->state == SNDRV_PCM_STATE_PREPARED) { runtime->status->state == SNDRV_PCM_STATE_PREPARED) {
if (size >= runtime->start_threshold) { if (size >= runtime->start_threshold) {
...@@ -2185,10 +2189,8 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, ...@@ -2185,10 +2189,8 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
} }
} }
runtime->twake = runtime->control->avail_min ? : 1;
if (runtime->status->state == SNDRV_PCM_STATE_RUNNING)
snd_pcm_update_hw_ptr(substream);
avail = snd_pcm_avail(substream); avail = snd_pcm_avail(substream);
while (size > 0) { while (size > 0) {
snd_pcm_uframes_t frames, appl_ptr, appl_ofs; snd_pcm_uframes_t frames, appl_ptr, appl_ofs;
snd_pcm_uframes_t cont; snd_pcm_uframes_t cont;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment