From 9d72b829d65462cdcf7c0e267181ea814ad37071 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 11 Jun 2018 12:22:46 +0100 Subject: [PATCH] Throw exceptions when things in the butler get really out of hand. --- src/lib/butler.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 #include @@ -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()); } -- 2.30.2