summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-07-21 21:50:29 +0200
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-07-21 21:50:29 +0200
commite36cce4683f347d4eb423fc3e9ba9a8892a6c793 (patch)
tree216f4304201683c693980d1f1d68609186ae1751
parent64e58f02324fb84ca2f6013fbfe48c4877a41ee1 (diff)
guarantee streamer sleep at the end of last track, to avoid 100% CPU load
-rw-r--r--streamer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/streamer.c b/streamer.c
index c84a4097..432bc16b 100644
--- a/streamer.c
+++ b/streamer.c
@@ -1840,9 +1840,12 @@ 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 ((bytes_until_next_song > 0 && stop_after_current) || (streamer_ringbuf.remaining > STREAM_BUFFER_SIZE / 2 && !streamer_buffering && alloc_time > 0)) {
+ if (streamer_ringbuf.remaining > STREAM_BUFFER_SIZE / 2 && !streamer_buffering && alloc_time > 0) {
usleep (alloc_time * 1000);
}
+ else if (bytes_until_next_song > 0) {
+ usleep (20000);
+ }
}
// stop streaming song