From aeeb396002ed730a361c49c147e7ddaba06bdaef Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 3 Mar 2002 09:24:14 +0000 Subject: [PATCH] Added abort when no more frames can be processed --- src/pcm/pcm_plugin.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c index 53635cf2..e1d53f8c 100644 --- a/src/pcm/pcm_plugin.c +++ b/src/pcm/pcm_plugin.c @@ -324,7 +324,10 @@ static snd_pcm_sframes_t snd_pcm_plugin_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_t *slave_areas; snd_pcm_uframes_t slave_offset; snd_pcm_uframes_t slave_frames = ULONG_MAX; + snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames); + if (slave_frames == 0) + break; frames = plugin->write(pcm, areas, offset, frames, slave_areas, slave_offset, &slave_frames); assert(slave_frames <= snd_pcm_mmap_playback_avail(slave)); @@ -332,7 +335,7 @@ static snd_pcm_sframes_t snd_pcm_plugin_write_areas(snd_pcm_t *pcm, snd_pcm_mmap_appl_forward(pcm, frames); result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames); snd_atomic_write_end(&plugin->watom); - if (result < 0) + if (result <= 0) return xfer > 0 ? xfer : result; offset += result; xfer += result; @@ -356,7 +359,10 @@ static snd_pcm_sframes_t snd_pcm_plugin_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_t *slave_areas; snd_pcm_uframes_t slave_offset; snd_pcm_uframes_t slave_frames = ULONG_MAX; + snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames); + if (slave_frames == 0) + break; frames = plugin->read(pcm, areas, offset, frames, slave_areas, slave_offset, &slave_frames); assert(slave_frames <= snd_pcm_mmap_capture_avail(slave)); @@ -364,7 +370,7 @@ static snd_pcm_sframes_t snd_pcm_plugin_read_areas(snd_pcm_t *pcm, snd_pcm_mmap_appl_forward(pcm, frames); result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames); snd_atomic_write_end(&plugin->watom); - if (result < 0) + if (result <= 0) return xfer > 0 ? xfer : result; offset += result; xfer += result; -- 2.47.1