From 71ab83292da50b080befd98b01804a120b94f65e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 12 Jul 2017 23:20:22 +0100 Subject: Report underruns from Butler::get_audio. --- src/lib/butler.cc | 9 +++++++-- src/lib/butler.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/butler.cc b/src/lib/butler.cc index 54c1acc4d..771c4e633 100644 --- a/src/lib/butler.cc +++ b/src/lib/butler.cc @@ -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 diff --git a/src/lib/butler.h b/src/lib/butler.h index f68504f0e..9949ab79b 100644 --- a/src/lib/butler.h +++ b/src/lib/butler.h @@ -40,7 +40,7 @@ public: void seek (DCPTime position, bool accurate); std::pair, DCPTime> get_video (); - void get_audio (float* out, Frame frames); + bool get_audio (float* out, Frame frames); void disable_audio (); -- cgit v1.2.3