From 53613ae56de4ee785d943c0cb91205c59d91f8f4 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 11 Sep 2022 12:22:21 +0200 Subject: [PATCH] Fix build on Centos where we don't have the std::atomic_store stuff apparently. --- src/lib/player.cc | 12 +++++++----- src/lib/player.h | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/lib/player.cc b/src/lib/player.cc index 0ff2c4032..c6803b054 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -344,9 +344,11 @@ Player::set_video_container_size (dcp::Size s) _video_container_size = s; - auto black = make_shared(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(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 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 ( - std::make_shared(black), + std::make_shared(_black_image), Crop(), optional(), _video_container_size, diff --git a/src/lib/player.h b/src/lib/player.h index 5abd59de2..22701cb2c 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -155,7 +155,7 @@ private: void emit_audio (std::shared_ptr data, dcpomatic::DCPTime time); std::shared_ptr 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 _video_container_size; - /** Should be accessed using the std::atomic... methods */ + + mutable boost::mutex _black_image_mutex; std::shared_ptr _black_image; /** true if the player should ignore all video; i.e. never produce any */ -- 2.30.2