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

index b7088f1d297b201325ec8c237d2f3455cac0e947..c04a433698102034f34b818e774f3144dc416d0b 100644 (file)
@@ -99,6 +99,7 @@ int const PlayerProperty::PLAYBACK_LENGTH = 705;
 Player::Player (shared_ptr<const Film> film, Image::Alignment subtitle_alignment)
        : _film (film)
        , _suspended (0)
+       , _ignore_video(false)
        , _tolerant (film->tolerant())
        , _audio_merger (_film->audio_frame_rate())
        , _subtitle_alignment (subtitle_alignment)
@@ -111,6 +112,7 @@ Player::Player (shared_ptr<const Film> film, shared_ptr<const Playlist> playlist
        : _film (film)
        , _playlist (playlist_)
        , _suspended (0)
+       , _ignore_video(false)
        , _tolerant (film->tolerant())
        , _audio_merger (_film->audio_frame_rate())
 {
@@ -498,9 +500,8 @@ Player::get_subtitle_fonts ()
 void
 Player::set_ignore_video ()
 {
-       boost::mutex::scoped_lock lm (_mutex);
        _ignore_video = true;
-       setup_pieces_unlocked ();
+       setup_pieces();
 }
 
 
index 71b3cc4644a6b14dfd6e13cdb8abb52c3772f691..c65ec40fe561f621cbd2a3a6aa4a80cdebc221ae 100644 (file)
@@ -178,7 +178,7 @@ private:
        std::shared_ptr<Image> _black_image;
 
        /** true if the player should ignore all video; i.e. never produce any */
-       bool _ignore_video = false;
+       boost::atomic<bool> _ignore_video;
        bool _ignore_audio = false;
        /** true if the player should ignore all text; i.e. never produce any */
        bool _ignore_text = false;