Fix build on Centos where we don't have the std::atomic_store stuff apparently. v2.16.26
authorCarl Hetherington <cth@carlh.net>
Sun, 11 Sep 2022 10:22:21 +0000 (12:22 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 11 Sep 2022 10:30:36 +0000 (12:30 +0200)
src/lib/player.cc
src/lib/player.h

index 0ff2c4032c0a2c7de5da3bdd381284e4a808feb9..c6803b0549383393274acf080cf452057d2d02dd 100644 (file)
@@ -344,9 +344,11 @@ Player::set_video_container_size (dcp::Size s)
 
        _video_container_size = s;
 
-       auto black = make_shared<Image>(AV_PIX_FMT_RGB24, _video_container_size, Image::Alignment::PADDED);
-       black->make_black ();
-       std::atomic_store(&_black_image, black);
+       {
+               boost::mutex::scoped_lock lm(_black_image_mutex);
+               _black_image = make_shared<Image>(AV_PIX_FMT_RGB24, _video_container_size, Image::Alignment::PADDED);
+               _black_image->make_black ();
+       }
 
        Change (ChangeType::DONE, PlayerProperty::VIDEO_CONTAINER_SIZE, false);
 }
@@ -397,10 +399,10 @@ Player::film_change (ChangeType type, Film::Property p)
 shared_ptr<PlayerVideo>
 Player::black_player_video_frame (Eyes eyes) const
 {
-       auto black = std::atomic_load(&_black_image);
+       boost::mutex::scoped_lock lm(_black_image_mutex);
 
        return std::make_shared<PlayerVideo> (
-               std::make_shared<const RawImageProxy>(black),
+               std::make_shared<const RawImageProxy>(_black_image),
                Crop(),
                optional<double>(),
                _video_container_size,
index 5abd59de26a8c8fbda3940bde6d05a67077fbab1..22701cb2ca452c486746f643063c7bb7affa1250 100644 (file)
@@ -155,7 +155,7 @@ private:
        void emit_audio (std::shared_ptr<AudioBuffers> data, dcpomatic::DCPTime time);
        std::shared_ptr<const Playlist> playlist () const;
 
-       /** Mutex to protect the whole Player state.  When it's used for the preview we have
+       /** Mutex to protect the most of the 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.
        */
@@ -173,7 +173,8 @@ private:
         *  the size of preview in a window.
         */
        boost::atomic<dcp::Size> _video_container_size;
-       /** Should be accessed using the std::atomic... methods */
+
+       mutable boost::mutex _black_image_mutex;
        std::shared_ptr<Image> _black_image;
 
        /** true if the player should ignore all video; i.e. never produce any */