Report underruns from Butler::get_audio.
authorCarl Hetherington <cth@carlh.net>
Wed, 12 Jul 2017 22:20:22 +0000 (23:20 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 12 Jul 2017 22:20:22 +0000 (23:20 +0100)
src/lib/butler.cc
src/lib/butler.h

index 54c1acc4dc083cee67f3e535fe97b11d5779e6b8..771c4e6334aa37b326acf5f1f9860d23430fc4cd 100644 (file)
@@ -226,11 +226,16 @@ Butler::player_changed ()
        }
 }
 
-void
+/** Try to get `frames' frames of audio and copy it into `out'.  Silence
+ *  will be filled if no audio is available.
+ *  @return true if there was a buffer underrun, otherwise false.
+ */
+bool
 Butler::get_audio (float* out, Frame frames)
 {
-       _audio.get (out, _audio_channels, frames);
+       bool const underrun = _audio.get (out, _audio_channels, frames);
        _summon.notify_all ();
+       return underrun;
 }
 
 void
index f68504f0e5cdb2e19384a5b34c3ea83e7b092789..9949ab79b59c6f9e65c47e4a31438931482761ca 100644 (file)
@@ -40,7 +40,7 @@ public:
 
        void seek (DCPTime position, bool accurate);
        std::pair<boost::shared_ptr<PlayerVideo>, DCPTime> get_video ();
-       void get_audio (float* out, Frame frames);
+       bool get_audio (float* out, Frame frames);
 
        void disable_audio ();