summaryrefslogtreecommitdiff
path: root/streamer.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-09-14 12:01:07 +0200
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-09-14 12:01:07 +0200
commit4935e5d89035f33c66ed5d3e7c6319e0ce801d6b (patch)
tree6f9caa76d35c0727697e5edafe3ab6b85321e880 /streamer.c
parent1799c4c34174ea36a60ba957f4399e70b1d79425 (diff)
streamer: fixed rounding error in time calculation (sid+eq stuttering fix)
Diffstat (limited to 'streamer.c')
-rw-r--r--streamer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/streamer.c b/streamer.c
index 54960e40..687d6ad9 100644
--- a/streamer.c
+++ b/streamer.c
@@ -1602,7 +1602,9 @@ streamer_thread (void *ctx) {
int ms = (tm2.tv_sec*1000+tm2.tv_usec/1000) - (tm1.tv_sec*1000+tm1.tv_usec/1000);
//trace ("slept %dms (alloc=%dms, bytespersec=%d, chan=%d, blocksize=%d), fill: %d/%d (cursor=%d)\n", alloc_time-ms, alloc_time, bytes_in_one_second, output->fmt.channels, blocksize, streamer_ringbuf.remaining, STREAM_BUFFER_SIZE, streamer_ringbuf.cursor);
- alloc_time -= ms;
+
+ // add 1ms here to compensate the rounding error
+ alloc_time -= ms+1;
if (!streamer_buffering && alloc_time > 0) {
usleep (alloc_time * 1000);
}