[alsa-devel] [PATCH 8/9] pcm: rewindable, forwardable: don't return stale data
Raymond Yau
superquad.vortex2 at gmail.com
Sun Sep 14 04:57:32 CEST 2014
>
> The current behavior of snd_pcm_rewindable and snd_pcm_forwardable means
> that the returned value is only accurate to one period. Or maybe even
> meaningless if period interrupts are off. Fetch the up-to-date position
> of the hardware pointer, as that's what is wanted by callers.
Why do dmix need to support rewind/forward since it also set the slave in
free run mode ?
>
> Signed-off-by: Alexander E. Patrakov <patrakov at gmail.com>
> ---
> src/pcm/pcm_dmix.c | 6 ++++++
> src/pcm/pcm_dshare.c | 6 ++++++
> src/pcm/pcm_dsnoop.c | 6 ++++++
> src/pcm/pcm_hw.c | 6 ++++++
> src/pcm/pcm_ioplug.c | 2 ++
> src/pcm/pcm_plugin.c | 6 ++++++
> 6 files changed, 32 insertions(+)
>
> diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c
> index babde6a..d9565f9 100644
> --- a/src/pcm/pcm_dmix.c
> +++ b/src/pcm/pcm_dmix.c
> @@ -661,6 +661,9 @@ static int snd_pcm_dmix_pause(snd_pcm_t *pcm
ATTRIBUTE_UNUSED, int enable ATTRIB
>
> static snd_pcm_sframes_t snd_pcm_dmix_rewindable(snd_pcm_t *pcm)
> {
> + int err = snd_pcm_dmix_hwsync(pcm);
> + if (err < 0)
> + return err;
> return snd_pcm_mmap_playback_hw_rewindable(pcm);
> }
>
> @@ -744,6 +747,9 @@ static snd_pcm_sframes_t
snd_pcm_dmix_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t f
>
> static snd_pcm_sframes_t snd_pcm_dmix_forwardable(snd_pcm_t *pcm)
> {
> + int err = snd_pcm_dmix_hwsync(pcm);
> + if (err < 0)
> + return err;
> return snd_pcm_mmap_avail(pcm);
> }
>
More information about the Alsa-devel
mailing list