From: Clemens Ladisch Date: Mon, 13 Mar 2006 10:38:51 +0000 (+0000) Subject: rate plugin: optimize calculation of the continuous buffer part X-Git-Tag: v1.0.11rc4~18 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=931e840a9fd462b897856a8ea4eea41d5e869e84;p=alsa-lib.git rate plugin: optimize calculation of the continuous buffer part 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(). --- diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index bc78835d..7f42fa30 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -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,