summaryrefslogtreecommitdiff
path: root/src/lib/butler.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-06-11 12:22:46 +0100
committerCarl Hetherington <cth@carlh.net>2018-06-11 12:22:46 +0100
commit9d72b829d65462cdcf7c0e267181ea814ad37071 (patch)
tree7b80435bab697d3bb0efdf94a71b51ca8b5e24e8 /src/lib/butler.cc
parentd9f0bd8e009b094a8c75332995971f5b92642d16 (diff)
Throw exceptions when things in the butler get really out of hand.v2.13.31
Diffstat (limited to 'src/lib/butler.cc')
-rw-r--r--src/lib/butler.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/butler.cc b/src/lib/butler.cc
index f7c3c8fd9..223f8d579 100644
--- a/src/lib/butler.cc
+++ b/src/lib/butler.cc
@@ -23,6 +23,7 @@
#include "util.h"
#include "log.h"
#include "compose.hpp"
+#include "exceptions.h"
#include <boost/weak_ptr.hpp>
#include <boost/shared_ptr.hpp>
@@ -97,6 +98,18 @@ Butler::~Butler ()
bool
Butler::should_run () const
{
+ if (_video.size() >= MAXIMUM_VIDEO_READAHEAD * 10) {
+ /* This is way too big */
+ throw ProgrammingError
+ (__FILE__, __LINE__, String::compose ("Butler video buffers reached %1 frames (audio is %2)", _video.size(), _audio.size()));
+ }
+
+ if (_audio.size() >= MAXIMUM_AUDIO_READAHEAD * 10) {
+ /* This is way too big */
+ throw ProgrammingError
+ (__FILE__, __LINE__, String::compose ("Butler audio buffers reached %1 frames (video is %2)", _audio.size(), _video.size()));
+ }
+
if (_video.size() >= MAXIMUM_VIDEO_READAHEAD * 2) {
LOG_WARNING ("Butler video buffers reached %1 frames (audio is %2)", _video.size(), _audio.size());
}