From 7aacaed904d237b2ae737a8bc8104101585446cb Mon Sep 17 00:00:00 2001 From: Ricardo Biehl Pasquali Date: Tue, 18 Dec 2018 23:24:19 -0200 Subject: pcm: Exit loop when there are no available frames Signed-off-by: Ricardo Biehl Pasquali --- src/pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pcm.c') diff --git a/src/pcm.c b/src/pcm.c index e6f3b48..474295a 100644 --- a/src/pcm.c +++ b/src/pcm.c @@ -1259,7 +1259,7 @@ static int pcm_mmap_transfer_areas(struct pcm *pcm, char *buf, int commit; unsigned int pcm_offset, frames, count = 0; - while (size > 0) { + while (pcm_mmap_avail(pcm) && size) { frames = size; pcm_mmap_begin(pcm, &pcm_areas, &pcm_offset, &frames); pcm_areas_copy(pcm, pcm_offset, buf, offset, frames); -- cgit v1.2.3