From: Stefan BrĂ¼ns Date: Sun, 22 Nov 2015 21:14:15 +0000 (+0100) Subject: input/wav: fix error in offset calculation X-Git-Tag: libsigrok-0.4.0~89 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=288f8ce23cf0cf9a66e0ffe824f693009f942d07;p=libsigrok.git input/wav: fix error in offset calculation --- diff --git a/src/input/wav.c b/src/input/wav.c index 1b985edc..d1299cd3 100644 --- a/src/input/wav.c +++ b/src/input/wav.c @@ -279,8 +279,8 @@ static int process_buffer(struct sr_input *in) offset = 0; /* Round off up to the last channels * unitsize boundary. */ - chunk_samples = (in->buf->len - offset) / inc->num_channels / inc->unitsize; - max_chunk_samples = CHUNK_SIZE / inc->num_channels / inc->unitsize; + chunk_samples = (in->buf->len - offset) / inc->samplesize; + max_chunk_samples = CHUNK_SIZE / inc->samplesize; processed = 0; total_samples = chunk_samples; while (processed < total_samples) { @@ -289,7 +289,7 @@ static int process_buffer(struct sr_input *in) else num_samples = chunk_samples; send_chunk(in, offset, num_samples); - offset += num_samples * inc->unitsize; + offset += num_samples * inc->samplesize; chunk_samples -= num_samples; processed += num_samples; }