From 931e840a9fd462b897856a8ea4eea41d5e869e84 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 13 Mar 2006 10:38:51 +0000 Subject: [PATCH] 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(). --- src/pcm/pcm_rate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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, -- 2.47.1