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

index c04a433698102034f34b818e774f3144dc416d0b..ae76db5c471ed301ef60b2201e2bfce9f91b8d86 100644 (file)
@@ -100,6 +100,7 @@ Player::Player (shared_ptr<const Film> film, Image::Alignment subtitle_alignment
        : _film (film)
        , _suspended (0)
        , _ignore_video(false)
+       , _ignore_audio(false)
        , _tolerant (film->tolerant())
        , _audio_merger (_film->audio_frame_rate())
        , _subtitle_alignment (subtitle_alignment)
@@ -113,6 +114,7 @@ Player::Player (shared_ptr<const Film> film, shared_ptr<const Playlist> playlist
        , _playlist (playlist_)
        , _suspended (0)
        , _ignore_video(false)
+       , _ignore_audio(false)
        , _tolerant (film->tolerant())
        , _audio_merger (_film->audio_frame_rate())
 {
@@ -508,9 +510,8 @@ Player::set_ignore_video ()
 void
 Player::set_ignore_audio ()
 {
-       boost::mutex::scoped_lock lm (_mutex);
        _ignore_audio = true;
-       setup_pieces_unlocked ();
+       setup_pieces();
 }
 
 
index c65ec40fe561f621cbd2a3a6aa4a80cdebc221ae..03b7ffebd2ad5b48c824194e5175cea074dfacf5 100644 (file)
@@ -179,7 +179,7 @@ private:
 
        /** true if the player should ignore all video; i.e. never produce any */
        boost::atomic<bool> _ignore_video;
-       bool _ignore_audio = false;
+       boost::atomic<bool> _ignore_audio;
        /** true if the player should ignore all text; i.e. never produce any */
        bool _ignore_text = false;
        bool _always_burn_open_subtitles = false;