From 796c80dd7311f7db3c4c097c11357c0dd17200d9 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Tue, 29 Jul 2014 19:50:14 +0200 Subject: streamer regression bugfix --- streamer.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/streamer.c b/streamer.c index ec475c9d..2811467f 100644 --- a/streamer.c +++ b/streamer.c @@ -1786,11 +1786,6 @@ streamer_thread (void *ctx) { int bytes_in_one_second = rate * (output->fmt.bps>>3) * channels; int blocksize = bytes_in_one_second / 40; - int samplesize = output->fmt.channels * (output->fmt.bps>>3); - if (blocksize % samplesize) { - blocksize -= (blocksize % samplesize); - } - if (blocksize < MIN_BLOCK_SIZE) { blocksize = MIN_BLOCK_SIZE; } @@ -1798,6 +1793,8 @@ streamer_thread (void *ctx) { blocksize = MAX_BLOCK_SIZE; } + blocksize &= ~3; // 4byte alignment is required + int alloc_time = 1000 / (bytes_in_one_second / blocksize); int skip = 0; @@ -1876,7 +1873,7 @@ streamer_thread (void *ctx) { // add 1ms here to compensate the rounding error // and another 1ms to buffer slightly faster then playing alloc_time -= ms+2; - if (streamer_buffering || streamer_ringbuf.remaining > STREAM_BUFFER_SIZE / 2) { + if (streamer_buffering || streamer_ringbuf.remaining < STREAM_BUFFER_SIZE / 2) { alloc_time >>= 1; } if (alloc_time > 0) { -- cgit v1.2.3