diff options
author | Alexey Yakovenko <waker@users.sourceforge.net> | 2013-09-14 12:01:07 +0200 |
---|---|---|
committer | Alexey Yakovenko <waker@users.sourceforge.net> | 2013-09-14 12:01:07 +0200 |
commit | 4935e5d89035f33c66ed5d3e7c6319e0ce801d6b (patch) | |
tree | 6f9caa76d35c0727697e5edafe3ab6b85321e880 /streamer.c | |
parent | 1799c4c34174ea36a60ba957f4399e70b1d79425 (diff) |
streamer: fixed rounding error in time calculation (sid+eq stuttering fix)
Diffstat (limited to 'streamer.c')
-rw-r--r-- | streamer.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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); } |