diff mbox series

[alsa-lib,2/4] pcm: ioplug: Pass appl_ptr and hw_ptr in snd_pcm_status()

Message ID 20210122144842.8843-3-tiwai@suse.de (mailing list archive)
State New, archived
Headers show
Series pcm: Fix missing appl_ptr and hw_ptr updates in snd_pcm_status() | expand

Commit Message

Takashi Iwai Jan. 22, 2021, 2:48 p.m. UTC
The snd_pcm_status() of the ioplug doesn't return the current
positions of hw_ptr and appl_ptr as advertised.  Fix it by copying the
current values stored in the plugin data.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
 src/pcm/pcm_ioplug.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series


diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c
index e141b1f98da7..a1463bf6b50a 100644
--- a/src/pcm/pcm_ioplug.c
+++ b/src/pcm/pcm_ioplug.c
@@ -133,6 +133,8 @@  static int snd_pcm_ioplug_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
 	gettimestamp(&status->tstamp, pcm->tstamp_type);
 	status->avail = snd_pcm_mmap_avail(pcm);
 	status->avail_max = io->avail_max;
+	status->appl_ptr = *pcm->appl.ptr;
+	status->hw_ptr = *pcm->hw.ptr;
 	if (snd_pcm_ioplug_delay(pcm, &sd) < 0)
 		sd = snd_pcm_mmap_delay(pcm);
 	status->delay = sd;