pcm: fix snd_pcm_plugin_status()

The appl_ptr difference must be computed before
the appl_ptr in the status structure is updated.

Fixes: da5b70d3f ("pcm: plugin - fix status code for capture")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2021-02-24 21:03:29 +01:00
parent 19ad9bdc49
commit 1d1062d920

View file

@ -564,8 +564,8 @@ static int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
* snd_pcm_status() * snd_pcm_status()
*/ */
if (pcm->stream == SND_PCM_STREAM_CAPTURE) { if (pcm->stream == SND_PCM_STREAM_CAPTURE) {
status->appl_ptr = *pcm->appl.ptr;
diff = pcm_frame_diff(status->appl_ptr, *pcm->appl.ptr, pcm->boundary); diff = pcm_frame_diff(status->appl_ptr, *pcm->appl.ptr, pcm->boundary);
status->appl_ptr = *pcm->appl.ptr;
status->avail += diff; status->avail += diff;
status->delay += diff; status->delay += diff;
} else { } else {