/*
- Copyright (C) 2016-2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
return time;
}
+optional<DCPTime>
+AudioRingBuffers::peek () const
+{
+ boost::mutex::scoped_lock lm (_mutex);
+ if (_buffers.empty()) {
+ return optional<DCPTime>();
+ }
+ return _buffers.front().second;
+}
+
void
AudioRingBuffers::clear ()
{
/*
- Copyright (C) 2016-2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
void put (boost::shared_ptr<const AudioBuffers> data, DCPTime time, int frame_rate);
boost::optional<DCPTime> get (float* out, int channels, int frames);
+ boost::optional<DCPTime> peek () const;
void clear ();
Frame size () 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()));
+ optional<DCPTime> pos = _audio.peek();
+ if (pos) {
+ throw ProgrammingError
+ (__FILE__, __LINE__, String::compose ("Butler video buffers reached %1 frames (audio is %2 at %3)", _video.size(), _audio.size(), pos->get()));
+ } else {
+ 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()));
+ optional<DCPTime> pos = _audio.peek();
+ if (pos) {
+ throw ProgrammingError
+ (__FILE__, __LINE__, String::compose ("Butler audio buffers reached %1 frames at %2 (video is %3)", _audio.size(), pos->get(), _video.size()));
+ } else {
+ throw ProgrammingError
+ (__FILE__, __LINE__, String::compose ("Butler audio buffers reached %1 frames (video is %3)", _audio.size(), _video.size()));
+ }
}
if (_video.size() >= MAXIMUM_VIDEO_READAHEAD * 2) {