]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
Fix wrong implementation of input/output_frames in samplerate plugin
authorTakashi Iwai <tiwai@suse.de>
Thu, 22 Feb 2007 11:32:02 +0000 (12:32 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 22 Feb 2007 11:32:02 +0000 (12:32 +0100)
The libsamplerate rate plugin has wrong implementations of input_frames
and output_frames callbacks.  They have to be swapped.

From: Jean-Marc Valin <jean-marc.valin@usherbrooke.ca>

rate/rate_samplerate.c

index af5c9c08bd6d17841ca44db88c9da09bd6e424d7..d07e7cef2926838a5ac4379ac370c416b2d83b54 100644 (file)
@@ -38,7 +38,7 @@ static snd_pcm_uframes_t input_frames(void *obj, snd_pcm_uframes_t frames)
        struct rate_src *rate = obj;
        if (frames == 0)
                return 0;
-       return (snd_pcm_uframes_t)(frames * rate->ratio);
+       return (snd_pcm_uframes_t)(frames / rate->ratio);
 }
 
 static snd_pcm_uframes_t output_frames(void *obj, snd_pcm_uframes_t frames)
@@ -46,7 +46,7 @@ static snd_pcm_uframes_t output_frames(void *obj, snd_pcm_uframes_t frames)
        struct rate_src *rate = obj;
        if (frames == 0)
                return 0;
-       return (snd_pcm_uframes_t)(frames / rate->ratio);
+       return (snd_pcm_uframes_t)(frames * rate->ratio);
 }
 
 static void pcm_src_free(void *obj)