summaryrefslogtreecommitdiff
path: root/src/lib/butler.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-08-04 00:01:30 +0100
committerCarl Hetherington <cth@carlh.net>2018-08-04 00:01:30 +0100
commit54e6f206305d4275808cfce36987edcc61a6a779 (patch)
treeba403ce56da8c5ce5a4a1652e83bd18855a41c01 /src/lib/butler.cc
parent4fe1a062eb31d680b8b4ac0191b9e2fc2d6aaec3 (diff)
Timestamp audio emissions from butler and hence discard very late
audio in FilmViewer. This should help with the case where lots of video frames are rapidly discarded when they are late but the corresponding audio is not, hence audio buffers get overfilled.
Diffstat (limited to 'src/lib/butler.cc')
-rw-r--r--src/lib/butler.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/butler.cc b/src/lib/butler.cc
index 63fe729ae..aee584654 100644
--- a/src/lib/butler.cc
+++ b/src/lib/butler.cc
@@ -62,7 +62,7 @@ Butler::Butler (shared_ptr<Player> player, shared_ptr<Log> log, AudioMapping aud
, _disable_audio (false)
{
_player_video_connection = _player->Video.connect (bind (&Butler::video, this, _1, _2));
- _player_audio_connection = _player->Audio.connect (bind (&Butler::audio, this, _1));
+ _player_audio_connection = _player->Audio.connect (bind (&Butler::audio, this, _1, _2));
_player_changed_connection = _player->Changed.connect (bind (&Butler::player_changed, this, _1));
_thread = new boost::thread (bind (&Butler::thread, this));
#ifdef DCPOMATIC_LINUX
@@ -258,7 +258,7 @@ Butler::video (shared_ptr<PlayerVideo> video, DCPTime time)
}
void
-Butler::audio (shared_ptr<AudioBuffers> audio)
+Butler::audio (shared_ptr<AudioBuffers> audio, DCPTime time)
{
{
boost::mutex::scoped_lock lm (_mutex);
@@ -269,19 +269,19 @@ Butler::audio (shared_ptr<AudioBuffers> audio)
}
boost::mutex::scoped_lock lm2 (_video_audio_mutex);
- _audio.put (remap (audio, _audio_channels, _audio_mapping));
+ _audio.put (remap (audio, _audio_channels, _audio_mapping), time);
}
/** 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.
+ * @return time of this audio, or unset if there was a buffer underrun.
*/
-bool
+optional<DCPTime>
Butler::get_audio (float* out, Frame frames)
{
- bool const underrun = _audio.get (out, _audio_channels, frames);
+ optional<DCPTime> t = _audio.get (out, _audio_channels, frames);
_summon.notify_all ();
- return underrun;
+ return t;
}
void