summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-01-15 00:42:58 +0000
committerCarl Hetherington <cth@carlh.net>2018-01-15 00:42:58 +0000
commit1a0aeb9b5639f31dc50e4a2c72c4dc33899a7d4a (patch)
treeee64da376f0a8ad51991279617b2ccb3d94f2852 /src/lib
parentb93167217949c866135eeeefc1dae003a7fb88f7 (diff)
Fix incorrect reel lengths when start-trimmed movie content follows
image-only content (e.g. crash1.xml in dcpomatic-test). We must consider the _silent "source" to be like an audio stream when deciding when to pull up to.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/player.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index eb8593e43..553921726 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -592,12 +592,18 @@ Player::pass ()
/* Emit any audio that is ready */
+ /* Work out the time before which the audio is definitely all here. This is the earliest last_push_end of one
+ of our streams, or the position of the _silent.
+ */
DCPTime pull_to = _film->length ();
for (map<AudioStreamPtr, StreamState>::const_iterator i = _stream_states.begin(); i != _stream_states.end(); ++i) {
if (!i->second.piece->done && i->second.last_push_end < pull_to) {
pull_to = i->second.last_push_end;
}
}
+ if (!_silent.done() && _silent.position() < pull_to) {
+ pull_to = _silent.position();
+ }
list<pair<shared_ptr<AudioBuffers>, DCPTime> > audio = _audio_merger.pull (pull_to);
for (list<pair<shared_ptr<AudioBuffers>, DCPTime> >::iterator i = audio.begin(); i != audio.end(); ++i) {
@@ -921,6 +927,8 @@ Player::emit_video (shared_ptr<PlayerVideo> pv, DCPTime time)
void
Player::emit_audio (shared_ptr<AudioBuffers> data, DCPTime time)
{
+ /* This audio must follow on from the previous */
+ DCPOMATIC_ASSERT (!_last_audio_time || time == *_last_audio_time);
Audio (data, time);
_last_audio_time = time + DCPTime::from_frames (data->frames(), _film->audio_frame_rate());
}