aboutsummaryrefslogtreecommitdiffstats
path: root/src/OutputInternal.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-11-06 23:47:30 +0100
committerMax Kellermann <max@duempel.org>2013-11-06 23:51:17 +0100
commitf8f95e2dbd73d0d43211136e50a8d640f145872c (patch)
tree9d4ea69a9c668f6286e0dc6de38ec5dfb650a55e /src/OutputInternal.hxx
parent77c63511d8809f7785328138e7e3a50303302730 (diff)
downloadmpd-f8f95e2dbd73d0d43211136e50a8d640f145872c.tar.gz
mpd-f8f95e2dbd73d0d43211136e50a8d640f145872c.tar.xz
mpd-f8f95e2dbd73d0d43211136e50a8d640f145872c.zip
OutputControl: reduce the number of OutputThread wakeups
Wake up the OutputThread only if it hasn't already been woken up and if it isn't already in the playback loop.
Diffstat (limited to 'src/OutputInternal.hxx')
-rw-r--r--src/OutputInternal.hxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/OutputInternal.hxx b/src/OutputInternal.hxx
index 2b3136f94..c07cdf856 100644
--- a/src/OutputInternal.hxx
+++ b/src/OutputInternal.hxx
@@ -128,6 +128,21 @@ struct audio_output {
bool allow_play;
/**
+ * True while the OutputThread is inside ao_play(). This
+ * means the PlayerThread does not need to wake up the
+ * OutputThread when new chunks are added to the MusicPipe,
+ * because the OutputThread is already watching that.
+ */
+ bool in_playback_loop;
+
+ /**
+ * Has the OutputThread been woken up to play more chunks?
+ * This is set by audio_output_play() and reset by ao_play()
+ * to reduce the number of duplicate wakeups.
+ */
+ bool woken_for_play;
+
+ /**
* If not nullptr, the device has failed, and this timer is used
* to estimate how long it should stay disabled (unless
* explicitly reopened with "play").