Remove dubious _buffers_mutex and maintain a lock on _mutex for
[dcpomatic.git] / src / lib / butler.cc
index 2d6c46c7eea0b04f7cc880e0819fad7bb1badf4c..6062b0f21f67a9e09ba7a818a8e12285a67f2cff 100644 (file)
@@ -275,12 +275,9 @@ Butler::seek_unlocked (DCPTime position, bool accurate)
        _pending_seek_position = position;
        _pending_seek_accurate = accurate;
 
-       {
-               boost::mutex::scoped_lock lm (_buffers_mutex);
-               _video.clear ();
-               _audio.clear ();
-               _closed_caption.clear ();
-       }
+       _video.clear ();
+       _audio.clear ();
+       _closed_caption.clear ();
 
        _summon.notify_all ();
 }
@@ -316,22 +313,18 @@ Butler::video (shared_ptr<PlayerVideo> video, DCPTime time)
 
        _prepare_service.post (bind (&Butler::prepare, this, weak_ptr<PlayerVideo>(video)));
 
-       boost::mutex::scoped_lock lm2 (_buffers_mutex);
        _video.put (video, time);
 }
 
 void
 Butler::audio (shared_ptr<AudioBuffers> audio, DCPTime time, int frame_rate)
 {
-       {
-               boost::mutex::scoped_lock lm (_mutex);
-               if (_pending_seek_position || _disable_audio) {
-                       /* Don't store any audio in these cases */
-                       return;
-               }
+       boost::mutex::scoped_lock lm (_mutex);
+       if (_pending_seek_position || _disable_audio) {
+               /* Don't store any audio in these cases */
+               return;
        }
 
-       boost::mutex::scoped_lock lm2 (_buffers_mutex);
        _audio.put (remap (audio, _audio_channels, _audio_mapping), time, frame_rate);
 }
 
@@ -406,6 +399,5 @@ Butler::text (PlayerText pt, TextType type, optional<DCPTextTrack> track, DCPTim
 
        DCPOMATIC_ASSERT (track);
 
-       boost::mutex::scoped_lock lm2 (_buffers_mutex);
        _closed_caption.put (pt, *track, period);
 }