diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-04-26 11:01:44 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-04-26 11:01:44 +0100 |
| commit | d0ecbc635fa3931fe6a588c3ffb038d1f3e1b11c (patch) | |
| tree | 08bf7ebd62667e011c26f6d0115da3fd3a81b43b /src/lib/butler.cc | |
| parent | 3a7adf45e7820902e446c56114e25075e0a42a1f (diff) | |
Fix video flickering when seeking near the end of the film.
Diffstat (limited to 'src/lib/butler.cc')
| -rw-r--r-- | src/lib/butler.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/butler.cc b/src/lib/butler.cc index b9aa0a5db..89095613d 100644 --- a/src/lib/butler.cc +++ b/src/lib/butler.cc @@ -42,9 +42,9 @@ Butler::Butler (weak_ptr<const Film> film, shared_ptr<Player> player, AudioMappi , _pending_seek_accurate (false) , _finished (false) , _died (false) + , _stop_thread (false) , _audio_mapping (audio_mapping) , _audio_channels (audio_channels) - , _stop_thread (false) , _disable_audio (false) { _player_video_connection = _player->Video.connect (bind (&Butler::video, this, _1, _2)); @@ -55,7 +55,11 @@ Butler::Butler (weak_ptr<const Film> film, shared_ptr<Player> player, AudioMappi Butler::~Butler () { - _stop_thread = true; + { + boost::mutex::scoped_lock lm (_mutex); + _stop_thread = true; + } + _thread->interrupt (); try { _thread->join (); @@ -65,6 +69,7 @@ Butler::~Butler () delete _thread; } +/** Caller must hold a lock on _mutex */ bool Butler::should_run () const { @@ -97,7 +102,8 @@ try lm.unlock (); bool const r = _player->pass (); lm.lock (); - if (r) { + /* We must check _pending_seek_position again here as it may have been set while lm was unlocked */ + if (r && !_pending_seek_position) { _finished = true; _arrived.notify_all (); break; |
