pcm: rate: Don't return negative frame count on success in rewind
PATCH 1/1 pcm: rate: Don't return negative frame count on success in rewind
snd_pcm_rewind is documented to return <0 on failure and >=0 on success.
Signed-off-by Andrew Eikum <[email protected]>
---
I checked all other rewind implementations, and this was the only one that obviously had this bug.
src/pcm/pcm_rate.c +1 -1
@@ -702,7 +702,7 @@ static snd_pcm_sframes_t snd_pcm_rate_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t fsnd_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)
Signature · 1 line
1.9.1
2014-04-05 2:27 GMT+08:00 Andrew Eikum <[email protected]>:
Quoted 3 lines
snd_pcm_rewindis documented to return <0 on failure and >=0 on success.
does all resampler support rewind ?
why do rate plugin assume all hardware support rewind ?
Takashi Iwai
AppliedAt Fri, 4 Apr 2014 13:27:25 -0500,
Quoted 5 lines · Andrew Eikum
snd_pcm_rewindis documented to return <0 on failure and >=0 on success.Signed-off-by Andrew Eikum <[email protected]>
Thanks, applied now.
Takashi
Quoted 26 lines
---
I checked all other rewind implementations, and this was the only one that obviously had this bug.src/pcm/pcm_rate.c +1
-1@@ -702,7 +702,7 @@ static snd_pcm_sframes_t snd_pcm_rate_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t fsnd_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)Signature · 7 lines
1.9.1 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel