diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-07-26 20:59:04 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-07-26 20:59:04 +0100 |
| commit | 3009a585f5222a83213c786e3c564c740f450d18 (patch) | |
| tree | ba65c1dc9ca643656160a6b7045f14c185fdd8f8 /src/lib/player.h | |
| parent | 8484d278ec6905502bd1178cc58d8cb7b3c12df0 (diff) | |
Protect the public API of Player with a mutex, since
seek() and pass() may be called from the Butler thread
ad the same time as other Player methods are called from
the GUI thread (by FilmViewer and ClosedCaptionViewDialog).
Diffstat (limited to 'src/lib/player.h')
| -rw-r--r-- | src/lib/player.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/player.h b/src/lib/player.h index 223db86b3..4a91c4c52 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -73,6 +73,7 @@ public: std::list<boost::shared_ptr<Font> > get_subtitle_fonts (); std::list<ReferencedReelAsset> get_reel_assets (); dcp::Size video_container_size () const { + boost::mutex::scoped_lock lm (_mutex); return _video_container_size; } @@ -141,6 +142,12 @@ private: void do_emit_video (boost::shared_ptr<PlayerVideo> pv, DCPTime time); void emit_audio (boost::shared_ptr<AudioBuffers> data, DCPTime time); + /** Mutex to protect the whole Player state. When it's used for the preview we have + seek() and pass() called from the Butler thread and lots of other stuff called + from the GUI thread. + */ + mutable boost::mutex _mutex; + boost::shared_ptr<const Film> _film; boost::shared_ptr<const Playlist> _playlist; |
