Commit 17d9c170 authored by Max Kellermann's avatar Max Kellermann

player: don't wake up decoder after every frame

The decoder was woken up after each chunk which had been played. That caused a lot of superfluous context switches. Wake up the decoder only when a certain amount of the buffer has been consumed. This formula is somewhat arbitrary, and has to be proven experimentally.
parent f41fe1e0
......@@ -339,7 +339,13 @@ static void do_play(void)
sizeToTime) < 0)
break;
ob_shift();
notify_signal(&dc.notify);
/* this formula should prevent that the
decoder gets woken up with each chunk; it
is more efficient to make it decode a
larger block at a time */
if (ob_available() <= (pc.buffered_before_play + ob.size * 3) / 4)
notify_signal(&dc.notify);
} else if (!ob_is_empty() && (int)ob.begin == next) {
/* at the beginning of a new song */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment