[alsa-devel] [PATCH alsa-lib 06/12] pcm: hw: use helper function to query status/control data after REWIND/FORWARD call

Takashi Sakamoto o-takashi at sakamocchi.jp
Fri Jun 30 01:58:22 CEST 2017


When operating rewind/forward, appl_ptr is recalculated by ALSA PCM core
in kernel space. Therefore, after the operations, applications should
query appl_ptr.

This commit utilizes a helper function for this purpose. The value of
avail_min is relevant to this operation, thus just queried.

Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
---
 src/pcm/pcm_hw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
index 6f20cbff..59ba33b5 100644
--- a/src/pcm/pcm_hw.c
+++ b/src/pcm/pcm_hw.c
@@ -702,7 +702,7 @@ static snd_pcm_sframes_t snd_pcm_hw_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t fra
 		SYSMSG("SNDRV_PCM_IOCTL_REWIND failed (%i)", err);
 		return err;
 	}
-	err = sync_ptr(hw, SNDRV_PCM_SYNC_PTR_APPL);
+	err = query_state(hw);
 	if (err < 0)
 		return err;
 	return frames;
@@ -723,7 +723,7 @@ static snd_pcm_sframes_t snd_pcm_hw_forward(snd_pcm_t *pcm, snd_pcm_uframes_t fr
 			SYSMSG("SNDRV_PCM_IOCTL_FORWARD failed (%i)", err);
 			return err;
 		}
-		err = sync_ptr(hw, SNDRV_PCM_SYNC_PTR_APPL);
+		err = query_state(hw);
 		if (err < 0)
 			return err;
 		return frames;
-- 
2.11.0



More information about the Alsa-devel mailing list