diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/butler.cc | 11 |
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; |
