X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fplayer.cc;h=cc8556f3d61d399d08b4ecdf50476f3d55b502a8;hb=d4f3df54c143b4d99dc06765208b62105f0cdca1;hp=c09bcd9feb4fbae78297303d16e72aada60c85e1;hpb=f0e9267d0839c1eb3e716f6e73a5f1b37d0bad12;p=dcpomatic.git diff --git a/src/lib/player.cc b/src/lib/player.cc index c09bcd9fe..cc8556f3d 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -517,8 +517,8 @@ Player::get_reel_assets () int64_t const reel_duration = k->main_picture()->duration(); /* See doc/design/trim_reels.svg */ - Frame const reel_trim_start = min(reel_duration, max(0LL, trim_start - offset_from_start)); - Frame const reel_trim_end = min(reel_duration, max(0LL, reel_duration - (offset_from_end - trim_end))); + Frame const reel_trim_start = min(reel_duration, max(int64_t(0), trim_start - offset_from_start)); + Frame const reel_trim_end = min(reel_duration, max(int64_t(0), reel_duration - (offset_from_end - trim_end))); DCPTime const from = i->position() + DCPTime::from_frames (offset_from_start, _film->video_frame_rate()); if (j->reference_video ()) { @@ -613,8 +613,18 @@ Player::pass () switch (which) { case CONTENT: + { earliest_content->done = earliest_content->decoder->pass (); + shared_ptr dcp = dynamic_pointer_cast(earliest_content->content); + if (dcp && !_play_referenced && dcp->reference_audio()) { + /* We are skipping some referenced DCP audio content, so we need to update _last_audio_time + to `hide' the fact that no audio was emitted during the referenced DCP (though + we need to behave as though it was). + */ + _last_audio_time = dcp->end (_film); + } break; + } case BLACK: emit_video (black_player_video_frame(EYES_BOTH), _black.position()); _black.set_position (_black.position() + one_video_frame()); @@ -626,7 +636,11 @@ Player::pass () /* Sometimes the thing that happened last finishes fractionally before or after this silence. Bodge the start time of the silence to fix it. */ - DCPOMATIC_ASSERT (labs(period.from.get() - _last_audio_time->get()) < 2); + int64_t const error = labs(period.from.get() - _last_audio_time->get()); + if (error >= 2) { + _film->log()->log(String::compose("Silence starting before or after last audio by %1", error), LogEntry::TYPE_ERROR); + } + DCPOMATIC_ASSERT (error < 2); period.from = *_last_audio_time; } if (period.duration() > one_video_frame()) {