summaryrefslogtreecommitdiff
path: root/src/lib/video_ring_buffers.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-12-29 22:51:50 +0000
committerCarl Hetherington <cth@carlh.net>2017-12-29 22:51:50 +0000
commita5ea5c0d2637dd41e3d356cb62cac75b8cadf8ce (patch)
tree45ed553eeaf52a58dea79f66ab6345df1c1657d0 /src/lib/video_ring_buffers.cc
parent1701be8b9173c675169b5739fbd94f5e6f8d07d1 (diff)
Add basic memory-used stuff for butler and reduce minimum audio
readahead quite a bit. This in turn reduces the maximum butler memory usage as it will keep getting audio (and hence video) until the minimum audio readahead is hit.
Diffstat (limited to 'src/lib/video_ring_buffers.cc')
-rw-r--r--src/lib/video_ring_buffers.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/video_ring_buffers.cc b/src/lib/video_ring_buffers.cc
index a8688a1cd..2fc39d53c 100644
--- a/src/lib/video_ring_buffers.cc
+++ b/src/lib/video_ring_buffers.cc
@@ -20,6 +20,7 @@
#include "video_ring_buffers.h"
#include "player_video.h"
+#include "compose.hpp"
#include <boost/foreach.hpp>
#include <list>
#include <iostream>
@@ -28,6 +29,7 @@ using std::list;
using std::make_pair;
using std::cout;
using std::pair;
+using std::string;
using boost::shared_ptr;
using boost::optional;
@@ -81,3 +83,13 @@ VideoRingBuffers::earliest () const
return _data.front().second;
}
+
+pair<size_t, string>
+VideoRingBuffers::memory_used () const
+{
+ size_t m = 0;
+ for (list<pair<shared_ptr<PlayerVideo>, DCPTime> >::const_iterator i = _data.begin(); i != _data.end(); ++i) {
+ m += i->first->memory_used();
+ }
+ return make_pair(m, String::compose("%1 frames", _data.size()));
+}