, _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));
Butler::~Butler ()
{
- _stop_thread = true;
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ _stop_thread = true;
+ }
+
_thread->interrupt ();
try {
_thread->join ();
delete _thread;
}
+/** Caller must hold a lock on _mutex */
bool
Butler::should_run () const
{
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;
VideoRingBuffers _video;
AudioRingBuffers _audio;
+ /** mutex to protect _pending_seek_position, _pending_seek_acurate, _finished, _died, _stop_thread */
boost::mutex _mutex;
boost::condition _summon;
boost::condition _arrived;
boost::optional<DCPTime> _pending_seek_position;
bool _pending_seek_accurate;
-
bool _finished;
bool _died;
+ bool _stop_thread;
AudioMapping _audio_mapping;
int _audio_channels;
- bool _stop_thread;
bool _disable_audio;
boost::signals2::scoped_connection _player_video_connection;