[alsa-devel] [PATCH alsa-lib] pcm: rate: Don't return negative frame count on success in rewind
Takashi Iwai
tiwai at suse.de
Mon Apr 7 12:43:22 CEST 2014
At Fri, 4 Apr 2014 13:27:25 -0500,
Andrew Eikum wrote:
>
> snd_pcm_rewind is documented to return <0 on failure and >=0 on
> success.
>
> Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Thanks, applied now.
Takashi
> ---
> I checked all other rewind implementations, and this was the only one
> that obviously had this bug.
>
> diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
> index 54a3e67..2eb4b1b 100644
> --- a/src/pcm/pcm_rate.c
> +++ b/src/pcm/pcm_rate.c
> @@ -702,7 +702,7 @@ static snd_pcm_sframes_t snd_pcm_rate_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t f
> snd_atomic_write_begin(&rate->watom);
> n = snd_pcm_rate_move_applptr(pcm, -frames);
> snd_atomic_write_end(&rate->watom);
> - return n;
> + return n < 0 ? -n : n;
> }
>
> static snd_pcm_sframes_t snd_pcm_rate_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
> --
> 1.9.1
>
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
More information about the Alsa-devel
mailing list