Use atomic for _play_referenced.
authorCarl Hetherington <cth@carlh.net>
Sat, 10 Sep 2022 13:43:18 +0000 (15:43 +0200)
committerCarl Hetherington <cth@carlh.net>
Sat, 10 Sep 2022 21:20:57 +0000 (23:20 +0200)
src/lib/player.cc
src/lib/player.h

index 6361d7b2acc1f3d0d6fb523d15d72107f9449a9f..af963d50dd3fb6e05485c6eab9637f0d99abe157 100644 (file)
@@ -105,6 +105,7 @@ Player::Player (shared_ptr<const Film> film, Image::Alignment subtitle_alignment
        , _always_burn_open_subtitles(false)
        , _fast(false)
        , _tolerant (film->tolerant())
+       , _play_referenced(false)
        , _audio_merger (_film->audio_frame_rate())
        , _subtitle_alignment (subtitle_alignment)
 {
@@ -122,6 +123,7 @@ Player::Player (shared_ptr<const Film> film, shared_ptr<const Playlist> playlist
        , _always_burn_open_subtitles(false)
        , _fast(false)
        , _tolerant (film->tolerant())
+       , _play_referenced(false)
        , _audio_merger (_film->audio_frame_rate())
 {
        construct ();
@@ -549,9 +551,8 @@ Player::set_fast ()
 void
 Player::set_play_referenced ()
 {
-       boost::mutex::scoped_lock lm (_mutex);
        _play_referenced = true;
-       setup_pieces_unlocked ();
+       setup_pieces();
 }
 
 
index d16666bc51a4394bd92f49c7cd4fc442f6eca118..511a579a08baed0f8f0be5a5f46c9a6f78003d54 100644 (file)
@@ -188,7 +188,7 @@ private:
        /** true if we should keep going in the face of `survivable' errors */
        bool const _tolerant;
        /** true if we should `play' (i.e output) referenced DCP data (e.g. for preview) */
-       bool _play_referenced = false;
+       boost::atomic<bool> _play_referenced;
 
        /** Time of the next video that we will emit, or the time of the last accurate seek */
        boost::optional<dcpomatic::DCPTime> _next_video_time;