summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-04-18 10:56:51 +0100
committerCarl Hetherington <cth@carlh.net>2017-04-19 23:04:32 +0100
commitaae7e5eb06bf4016d95f3a193879c82f3c266de5 (patch)
tree7f39026b386299f7cafde7116f6a1425ebb5fe4c /src/lib
parent5c145bd08401405af7351a5a2eac767756f5dd5e (diff)
Tidy up slightly.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/butler.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/butler.cc b/src/lib/butler.cc
index de982a0fe..e88c29455 100644
--- a/src/lib/butler.cc
+++ b/src/lib/butler.cc
@@ -63,6 +63,13 @@ Butler::~Butler ()
delete _thread;
}
+bool
+Butler::should_run () const
+{
+ return (_video.size() < VIDEO_READAHEAD || _audio.size() < AUDIO_READAHEAD) && !_stop_thread && !_finished;
+}
+
+
void
Butler::thread ()
try
@@ -71,7 +78,7 @@ try
boost::mutex::scoped_lock lm (_mutex);
/* Wait until we have something to do */
- while ((_video.size() >= VIDEO_READAHEAD && _audio.size() >= AUDIO_READAHEAD && !_pending_seek_position) || _stop_thread) {
+ while (!should_run() && !_pending_seek_position) {
_summon.wait (lm);
}
@@ -85,7 +92,7 @@ try
while lm is unlocked, as in that state nothing will be added to
_video/_audio.
*/
- while ((_video.size() < VIDEO_READAHEAD || _audio.size() < AUDIO_READAHEAD) && !_pending_seek_position && !_stop_thread) {
+ while (should_run() && !_pending_seek_position) {
lm.unlock ();
if (_player->pass ()) {
_finished = true;