]> git.alsa-project.org Git - alsa-lib.git/commitdiff
rate plugin: optimize calculation of the continuous buffer part
authorClemens Ladisch <clemens@ladisch.de>
Mon, 13 Mar 2006 10:38:51 +0000 (10:38 +0000)
committerClemens Ladisch <clemens@ladisch.de>
Mon, 13 Mar 2006 10:38:51 +0000 (10:38 +0000)
When calculating the continuous part till the end of the buffer, we can
use the slave_frames value that has already been calculated by
snd_pcm_mmap_begin().

src/pcm/pcm_rate.c

index bc78835d16f04c60ba1bdd4ea26cac510573b305..7f42fa300e6723b8afa0090b598eb080244d0201 100644 (file)
@@ -1032,7 +1032,7 @@ static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate,
                        return result;
              __partial:
                xfer = 0;
-               cont = rate->gen.slave->buffer_size - slave_offset;
+               cont = slave_frames;
                if (cont > slave_size)
                        cont = slave_size;
                snd_pcm_areas_copy(slave_areas, slave_offset,
@@ -1123,7 +1123,7 @@ static int snd_pcm_rate_grab_next_period(snd_pcm_t *pcm, snd_pcm_uframes_t hw_of
                        return result;
              __partial:
                xfer = 0;
-               cont = rate->gen.slave->buffer_size - slave_offset;
+               cont = slave_frames;
                if (cont > rate->gen.slave->period_size)
                        cont = rate->gen.slave->period_size;
                snd_pcm_areas_copy(rate->sareas, 0,