diff options
-rw-r--r-- | streamer.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -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) { |