From e969e8854b79da36c338d7ecc88079b9f3ff27c8 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 24 Oct 2017 12:59:52 +0200 Subject: [PATCH] alsa-utils: calculate size correctly --- spa/plugins/alsa/alsa-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spa/plugins/alsa/alsa-utils.c b/spa/plugins/alsa/alsa-utils.c index ba7d6e832..59bc37e25 100644 --- a/spa/plugins/alsa/alsa-utils.c +++ b/spa/plugins/alsa/alsa-utils.c @@ -365,7 +365,7 @@ pull_frames(struct state *state, reuse = avail == n_bytes; } else { offs = SPA_MIN(d[0].chunk->offset + state->ready_offset, d[0].maxsize); - size = SPA_MIN(d[0].chunk->size, d[0].maxsize) - offs; + size = SPA_MIN(d[0].chunk->size + offs, d[0].maxsize) - offs; src = SPA_MEMBER(d[0].data, offs, uint8_t); n_bytes = SPA_MIN(size, to_write * state->frame_size);